Share via


IVsFilterKeys2.TranslateAcceleratorEx Method

Takes a Windows message, translates it into a command, and, optionally, executes the command.

Namespace:  Microsoft.VisualStudio.Shell.Interop
Assembly:  Microsoft.VisualStudio.Shell.Interop.8.0 (in Microsoft.VisualStudio.Shell.Interop.8.0.dll)

Syntax

'Declaration
Function TranslateAcceleratorEx ( _
    pMsg As MSG(), _
    dwFlags As UInteger, _
    cKeyBindingScopes As UInteger, _
    rgguidKeyBindingScopes As Guid(), _
    <OutAttribute> ByRef pguidCmd As Guid, _
    <OutAttribute> ByRef pdwCmd As UInteger, _
    <OutAttribute> ByRef fCmdTranslated As Integer, _
    <OutAttribute> ByRef pfKeyComboStartsChord As Integer _
) As Integer
'Usage
Dim instance As IVsFilterKeys2 
Dim pMsg As MSG()
Dim dwFlags As UInteger 
Dim cKeyBindingScopes As UInteger 
Dim rgguidKeyBindingScopes As Guid()
Dim pguidCmd As Guid 
Dim pdwCmd As UInteger 
Dim fCmdTranslated As Integer 
Dim pfKeyComboStartsChord As Integer 
Dim returnValue As Integer 

returnValue = instance.TranslateAcceleratorEx(pMsg, _
    dwFlags, cKeyBindingScopes, rgguidKeyBindingScopes, _
    pguidCmd, pdwCmd, fCmdTranslated, _
    pfKeyComboStartsChord)
int TranslateAcceleratorEx(
    MSG[] pMsg,
    uint dwFlags,
    uint cKeyBindingScopes,
    Guid[] rgguidKeyBindingScopes,
    out Guid pguidCmd,
    out uint pdwCmd,
    out int fCmdTranslated,
    out int pfKeyComboStartsChord
)
int TranslateAcceleratorEx(
    [InAttribute] array<MSG>^ pMsg, 
    [InAttribute] unsigned int dwFlags, 
    [InAttribute] unsigned int cKeyBindingScopes, 
    [InAttribute] array<Guid>^ rgguidKeyBindingScopes, 
    [OutAttribute] Guid% pguidCmd, 
    [OutAttribute] unsigned int% pdwCmd, 
    [OutAttribute] int% fCmdTranslated, 
    [OutAttribute] int% pfKeyComboStartsChord
)
function TranslateAcceleratorEx(
    pMsg : MSG[], 
    dwFlags : uint, 
    cKeyBindingScopes : uint, 
    rgguidKeyBindingScopes : Guid[], 
    pguidCmd : Guid, 
    pdwCmd : uint, 
    fCmdTranslated : int, 
    pfKeyComboStartsChord : int
) : int

Parameters

  • dwFlags
    Type: System.UInt32

    [in] Bit flags to determine whether or not to perform default actions, to execute the command, and the key bindings to use. Values formed from the __VSTRANSACCELEXFLAGS enumeration.

  • cKeyBindingScopes
    Type: System.UInt32

    [in] Number of key binding scopes to check. Length of the rgguidKeyBindingScopes array.

  • rgguidKeyBindingScopes
    Type: array<System.Guid[]

    [in] Array of GUIDs of the key binding scopes to use such as CMDUIGUID_TextEditor to use the current text editor key bindings.

  • pguidCmd
    Type: System.Guid%

    [out] Pointer to the GUID of the corresponding command.

  • pdwCmd
    Type: System.UInt32%

    [out] Pointer to the identifier of the command.

  • fCmdTranslated
    Type: System.Int32%

    [out] Boolean. Set to true if the message will translate to a command.

  • pfKeyComboStartsChord
    Type: System.Int32%

    [out] Boolean. Set to true if the key is the start of a multi-key sequence (chord).

Return Value

Type: System.Int32
If the message does or will translate to a command, the method returns S_OK, fills the pguidCmd and pdwCmd parameters with the command's GUID and ID, and sets fCmdTranslated to true. If the message does not or will not translate to a command, the method returns S_FALSE, sets the GUID and ID parameters to zero, and sets fCmdTranslated to false.

Remarks

COM Signature

From vsshell80.idl:

HRESULT TranslateAcceleratorEx(
  [in] LPMSG pMsg, 
  [in] VSTRANSACCELEXFLAGS dwFlags, 
  [in] DWORD cKeyBindingScopes,
  [in, size_is(cKeyBindingScopes)] const GUID rgguidKeyBindingScopes[],
  [out] GUID *pguidCmd, 
  [out] DWORD *pdwCmd,
  [out] BOOL *fCmdTranslated,
  [out] BOOL *pfKeyComboStartsChord
);

Notes to Callers

If you do not specify VSTAEXF_IgnoreActiveKBScopes, the currently active scopes are searched after those specified by the flags in dwFlags.

.NET Framework Security

See Also

Reference

IVsFilterKeys2 Interface

IVsFilterKeys2 Members

Microsoft.VisualStudio.Shell.Interop Namespace