To receive notifications, you must first register with the SVsShellMonitorSelection service by calling AdviseSelectionEvents. The pSink parameter to this method holds a pointer to your IVsSelectionEvents interface.
Each method in IVsSelectionEvents reports a different type of change. For example, when the current selection changes, your OnSelectionChanged method is called.
Notes to Implementers
VSPackages implement
IVsSelectionEvents to be able to track selection changes in the environment.