Some information relates to prerelease product that may be substantially modified before it’s released. Microsoft makes no warranties, express or implied, with respect to the information provided here.
These element IDs are the only element IDs that can be used with the selection service.
public: enum class VSConstants::VSSELELEMID
public enum VSConstants.VSSELELEMID
type VSConstants.VSSELELEMID =
Public Enum VSConstants.VSSELELEMID
If your code only needs to know when a window is activated, first implement the IVsSelectionEvents interface then query the shell for the selection monitoring service. This means: QueryService the shell for the service SID_SVsShellMonitorSelection and its interface IID_IVsMonitorSelection, retrieving IVsMonitorSelection. Next on that interface IVsMonitorSelection call AdviseSelectionEvents and send it a pointer to the IVsSelectionEvents handler that you implemented above. In your handler for the OnElementValueChanged call, look for
elementid == SEID_WindowFrame or
elementid == SEID_DocumentFrame. Test the
varValueNew parameter for a pointer to the window frame you are looking for. The following describes the significance of the OnElementValueChanged values:
|SEID_WindowFrame||Fires for both tool window and document window activation.|
|SEID_DocumentFrame||Fires only for document window activation.|
To get more selection information implement the IVsWindowFrameNotify interface. In previous versions of Visual Studio only the object set as the VSFPROPID_ViewHelper object was available. Visual Studio contains the new interface IVsWindowFrame2 which allows multiple parties to subscribe to these events.
These element IDs are the only element IDs that can be used with the selection service. Do not attempt to pass any other element IDs.
You can also use this mechanism to detect when you lose selection