IVsTextView.AddCommandFilter(IOleCommandTarget, IOleCommandTarget) Method

Definition

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

public:
 int AddCommandFilter(Microsoft::VisualStudio::OLE::Interop::IOleCommandTarget ^ pNewCmdTarg, [Runtime::InteropServices::Out] Microsoft::VisualStudio::OLE::Interop::IOleCommandTarget ^ % ppNextCmdTarg);
public:
 int AddCommandFilter(Microsoft::VisualStudio::OLE::Interop::IOleCommandTarget ^ pNewCmdTarg, [Runtime::InteropServices::Out] Microsoft::VisualStudio::OLE::Interop::IOleCommandTarget ^ &  ppNextCmdTarg);
int AddCommandFilter(Microsoft::VisualStudio::OLE::Interop::IOleCommandTarget const & pNewCmdTarg, [Runtime::InteropServices::Out] Microsoft::VisualStudio::OLE::Interop::IOleCommandTarget const & & ppNextCmdTarg);
public int AddCommandFilter (Microsoft.VisualStudio.OLE.Interop.IOleCommandTarget pNewCmdTarg, out Microsoft.VisualStudio.OLE.Interop.IOleCommandTarget ppNextCmdTarg);
abstract member AddCommandFilter : Microsoft.VisualStudio.OLE.Interop.IOleCommandTarget * IOleCommandTarget -> int
Public Function AddCommandFilter (pNewCmdTarg As IOleCommandTarget, ByRef ppNextCmdTarg As IOleCommandTarget) As Integer

Parameters

pNewCmdTarg
IOleCommandTarget

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

ppNextCmdTarg
IOleCommandTarget

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

Returns

If the method succeeds, it returns S_OK. If it fails, it returns an error code.

Remarks

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.

Applies to