Search
Module:
Directory

   Desktop Functions:

   Smart Device Functions:


Show Recent Changes
Subscribe (RSS)
Misc. Pages
Comments
FAQ
Helpful Tools
Playground
Suggested Reading
Website TODO List
Download Visual Studio Add-In

IOleCommandTarget (Interfaces)
 
.
Summary
TODO - a short description

C# Definition:

[ComImport,

Guid("b722bccb-4e68-101b-a2bc-00aa00404770"),

InterfaceType(ComInterfaceType.InterfaceIsIUnknown)]

public interface IOleCommandTarget

{

    //IMPORTANT: The order of the methods is critical here. You
    //perform early binding in most cases, so the order of the methods
    //here MUST match the order of their vtable layout (which is determined
    //by their layout in IDL). The interop calls key off the vtable
    //ordering, not the symbolic names. Therefore, if you switched these
    //method declarations and tried to call the Exec method on an
    //IOleCommandTarget interface from your application, it would
    //translate into a call to the QueryStatus method instead.
    void QueryStatus(
        ref Guid pguidCmdGroup,
        UInt32 cCmds,
        [MarshalAs(UnmanagedType.LPArray, SizeParamIndex = 1)] OLECMD[] prgCmds,
        ref OLECMDTEXT CmdText);
    void Exec(
        ref Guid pguidCmdGroup,
        uint nCmdId,
        uint nCmdExecOpt,
        ref object pvaIn,
        ref object pvaOut);

}

VB Definition:

<ComImport> _
<Guid("TODO")> _
'TODO: Insert <InterfaceType(ComInterfaceType.InterfaceIsIUnknown)> _ if this doesn't derive from IDispatch
Interface IOleCommandTarget
   TODO
End Interface

User-Defined Types:

None.

Notes:

None.

Documentation

The above didn't work as is in C#. I looked on other sites and found this declaration which works for me (at least with Exec function) :

C# Definition:

    [StructLayout(LayoutKind.Sequential)]
    public struct OLECMD
    {
        public UInt32 cmdID;
        public UInt64 cmdf;
    }

    [StructLayout(LayoutKind.Sequential)]
    public struct OLECMDTEXT
    {
        public UInt32 cmdtextf;
        public UInt32 cwActual;
        public UInt32 cwBuf;
        public char rgwz;
    }

    [ComImport, Guid("b722bccb-4e68-101b-a2bc-00aa00404770"), InterfaceType(ComInterfaceType.InterfaceIsIUnknown)]
    public interface IOleCommandTarget
    {

        //IMPORTANT: The order of the methods is critical here. You
        //perform early binding in most cases, so the order of the methods
        //here MUST match the order of their vtable layout (which is determined
        //by their layout in IDL). The interop calls key off the vtable
        //ordering, not the symbolic names. Therefore, if you switched these
        //method declarations and tried to call the Exec method on an
        //IOleCommandTarget interface from your application, it would
        //translate into a call to the QueryStatus method instead.
        [PreserveSig()]
        int QueryStatus([In, MarshalAs(UnmanagedType.Struct)] ref Guid pguidCmdGroup, [MarshalAs(UnmanagedType.U4)] int cCmds, [In, Out]IntPtr prgCmds, [In, Out] IntPtr pCmdText);

        [PreserveSig()]
        int Exec(ref Guid pguidCmdGroup, uint nCmdID, uint nCmdExecOpt, object[] pvaIn, [In, Out, MarshalAs(UnmanagedType.LPArray)] object[] pvaOut);
    }

Please edit this page!

Do you have...

  • helpful tips?
  • corrections to the existing content?
  • alternate definitions?
  • additional languages you want to include?

Select "Edit This Page" on the right hand toolbar and edit it! Or add new pages containing any supporting types needed.

 
Access PInvoke.net directly from VS:
Terms of Use
Find References
Show Printable Version
Revisions