OleActivate

3.1

  #include <ole.h>    

  OLESTATUS OleActivate(lpObject, verb, fShow, fTakeFocus, hwnd, lprcBound)    
  LPOLEOBJECT lpObject; /* address of object to activate */
  UINT verb; /* operation to perform, */  
  BOOL fShow; /* whether to show window */
  BOOL fTakeFocus; /* whether server gets focus */
  HWND hwnd; /* window handle of destination document */
  const RECT FAR* lprcBound; /* bounding rectangle for object display */

The OleActivate function opens an object for an operation. Typically, the object is edited or played.

Parameters

lpObject

Points to the object to activate.

verb

Specifies which operation to perform (0 = the primary verb, 1 = the secondary verb, and so on).

fShow

Specifies whether the window is to be shown. If the window is to be shown, this value is TRUE; otherwise, it is FALSE.

fTakeFocus

Specifies whether the server should get the focus. If the server should get the focus, this value is TRUE; otherwise, it is FALSE. This parameter is relevant only if the fShow parameter is TRUE.

hwnd

Identifies the window of the document containing the object.

lprcBound

Points to a RECT structure containing the coordinates of the bounding rectangle in which the destination document displays the object. The mapping mode of the device context determines the units for these coordinates.

Return Value

The return value is OLE_OK if the function is successful. Otherwise, it is an error value, which may be one of the following:

OLE_BUSY
OLE_ERROR_OBJECT
OLE_WAIT_FOR_RELEASE

Comments

Typically, a server is launched in a separate window; editing then occurs asynchronously. The client is notified of changes to the object through the callback function.

A client application might set the fShow parameter to FALSE if a server needed to remain active without being visible on the display. (In this case, the application would also use the OleSetData function.)

Client applications typically specify the primary verb when the user double-clicks an object. The server can take any action in response to the specified verb. If the server supports only one action, it takes that action no matter which value is passed in the verb parameter.

In future releases of the object linking and embedding (OLE) protocol, the hwnd and lprcBound parameters will be used to help determine the placement of the server's editing window.

See Also

OleQueryOpen, OleSetData