IVsTextView.AddCommandFilter Method

Adds a command filter to the existing chain of command filters.

Namespace:  Microsoft.VisualStudio.TextManager.Interop
Assembly:  Microsoft.VisualStudio.TextManager.Interop (in Microsoft.VisualStudio.TextManager.Interop.dll)

int AddCommandFilter(
	IOleCommandTarget pNewCmdTarg,
	out IOleCommandTarget ppNextCmdTarg
)

Parameters

pNewCmdTarg
Type: Microsoft.VisualStudio.OLE.Interop.IOleCommandTarget

[in] Pointer to the new command filter (IOleCommandTarget) to add to the command filter chain.

ppNextCmdTarg
Type: Microsoft.VisualStudio.OLE.Interop.IOleCommandTarget

[out] Pointer to a command filter used to handle commands not dealt with by the pNewCmdTarg command filter.

Return Value

Type: System.Int32
If the method succeeds, it returns S_OK. If it fails, it returns an error code.

COM Signature

From textmgr.idl:

HRESULT IVsTextView::AddCommandFilter(
   [in] IOleCommandTarget *pNewCmdTarg, 
   [out] IOleCommandTarget **ppNextCmdTarg
);

The text view uses a chain architecture for command filters. Call AddCommandFilter to add a new command filter to the chain and to handle commands for the text view. The environment then returns a pointer to another command filter. Use this second command filter to handle all of the commands that you do not want to send to your command filter.

To discontinue command handling, call RemoveCommandFilter.

Was this page helpful?
(1500 characters remaining)
Thank you for your feedback
Show:
© 2014 Microsoft