Microsoft KB Archive/99045

= Determining If an Object Is Capable of Visual Editing =

Article ID: 99045

Article Last Modified on 12/3/2003

-

APPLIES TO

 Microsoft OLE 2.0 Microsoft OLE 2.01 Microsoft OLE 4.0, when used with:  Microsoft Windows NT 4.0

 Microsoft Windows NT 3.51 Service Pack 5

 Microsoft Windows NT 4.0</li></ul>

 Microsoft Windows 95</li></ul>

 Microsoft Windows 2000 Standard Edition</li></ul> </li></ul>

-

<div class="notice_section">

This article was previously published under Q99045

<div class="summary_section">

SUMMARY
It is impossible for a container to consistently determine whether an object will attempt negotiation for visual editing. However, by determining whether the object supports the IOleInPlaceObject interface, the container may want to assume that the negotiation will occur.

The default object handler will always fail a call to QueryInterface for IOleInPlaceObject if the object is in the loaded state. The container must first run the object and then query for the IOleInPlaceObject interface. If this QueryInterface call succeeds, then the container can assume that the object supports visual editing, and may start negotiation on the execution of a verb.

<div class="moreinformation_section">

MORE INFORMATION
The following C++ code returns TRUE if an object may start visual negotiation when IOleObject::DoVerb is called: BOOL fCanInPlaceActivate(LPOLEOBJECT lpObject) { LPOLEINPLACEOBJECT lpInPlaceObject; BOOL retval;

// Run the object. OleRun(lpObject);

// Query for IOleInPlaceObject. HRESULT herr = lpObject->QueryInterface(IID_IOleInPlaceObject,                                           (LPVOID FAR *)                                            lpInPlaceObject);

// Check the return value. if (herr == NOERROR) {       retval = TRUE; lpInPlaceObject->Release; }   else retval = FALSE;

lpObject::Close(OLECLOSE_NOSAVE);

return retval; }

Additional query words: 2.00 3.50 4.00

Keywords: KB99045

-

[mailto:TECHNET@MICROSOFT.COM Send feedback to Microsoft]

© Microsoft Corporation. All rights reserved.