Home COM GDI+ WebBrowser Data Access

IOleCommandTarget Interface

 

IID_IOleCommandTarget

{B722BCCB-4E68-101B-A2BC-00AA00404770}

 

 

The IOleCommandTarget interface enables objects and their containers to dispatch commands to each other. For example, an object's toolbars may contain buttons for commands such as Print, Print Preview, Save, New, and Zoom.

 

Normal in-place activation guidelines recommend that you remove or disable such buttons because no efficient, standard mechanism has been available to dispatch them to the container. Similarly, a container has heretofore had no efficient means to send commands such as Print, Page Setup, and Properties to an in-place active object. Such simple command routing could have been handled through existing OLE Automation standards and the IDispatch interface, but the overhead with IDispatch is more than is required in the case of document objects. The IOleCommandTarget interface provides a simpler means to achieve the same ends.

 

Available commands are defined by integer identifiers in a group. The group itself is identified with a GUID. The interface allows a caller both to query for support of one or more commands within a group and to issue a supported command to the object.

 

 

Methods in VTable order

IUnknown Methods

Description

QueryInterface

Returns pointers to supported interfaces.

AddRef

Increments reference count.

Release

Decrements reference count.

IOleCommandTarget Methods

Description

QueryStatus

Queries object for status of commands.

Exec

Execute a command.

 

QueryStatus

 

FUNCTION IOleCommandTarget_QueryStatus ( _

  BYVAL pthis AS DWORD PTR _

, BYREF pguidCmdGroup AS GUID _

, BYVAL cCmds AS DWORD _

, BYVAL prgCmds AS DWORD _

, BYREF pCmdText AS OLECMDTEXT _

  ) AS LONG
 

  LOCAL HRESULT AS LONG
  CALL DWORD @@pthis[3] USING IOleCommandTarget_QueryStatus (pthis, pguidCmdGroup, cCmds, prgCmds, pCmdText) TO HRESULT
  FUNCTION = HRESULT
 

END FUNCTION

 

 

Exec

 

FUNCTION IOleCommandTarget_Exec ( _

  BYVAL pthis AS DWORD PTR _

, BYREF pguidCmdGroup AS GUID _

, BYVAL nCmdID AS DWORD _

, BYVAL nCmdexecopt AS DWORD _

, BYREF pvaIn AS VARIANT _

, BYREF pvaOut AS VARIANT _

  ) AS LONG
 

  LOCAL HRESULT AS LONG
  CALL DWORD @@pthis[4] USING IOleCommandTarget_Exec (pthis, pguidCmdGroup, nCmdID, nCmdexecopt, pvaIn, pvaOut) TO HRESULT
  FUNCTION = HRESULT
 

END FUNCTION

 

 

Page last updated on Monday, 03 April 2006 20:48:07 +0200