This is just a small sample that demonstrates how to capture VS events inside a VSPackage.
For more information, please refer to my blog post.
But, here is the gist of it:
In order to capture events (such as “Solution Opened”) in a VSPackage, you must already have a pointer to the DTE in your control; this pointer is usually passed to your control from your tool window. And of course, this cannot be done during the construction phase of the tool window; it must be done after the tool window is created.
Here is a simplistic view of the sequence of events:
In more concrete terms: