9.5.1 OleActivate

OLESTATUS OleActivate(lpObject, iVerb, fShow, fTakeFocus, hwnd, lpBounds)

LPOLEOBJECT lpObject;

WORD iVerb;

BOOL fShow;

BOOL fTakeFocus;

HWND hwnd;

const RECT FAR* lpBounds;

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

Parameter Description

lpObject Points to the object to activate.
iVerb Specifies which operation to perform (0 = the primary verb, 1 = the first secondary verb, 2 = the second 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. This parameter can be NULL.
lpBounds Points to a RECT structure containing the coordinates of the bounding rectangle in which the destination document displays the object. This parameter can be NULL. The mapping mode of the device context determines the units for these coordinates.

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 iVerb parameter.

The return value is OLE_OK if successful; otherwise, it could be one of the following:

OLE_BUSY

OLE_ERROR_OBJECT

OLE_WAIT_FOR_RELEASE

See AlsoOleQueryOpen, OleSetData