|
|
|
IOleObject Interface |
|
IID_IOleObject |
{00000112-0000-0000-C000-000000000046} |
|
The IOleObject interface is the principal means by which an embedded object provides basic functionality to, and communicates with, its container.
Call the methods of this interface to enable a container to communicate with an embedded object. A container must call DoVerb to activate an embedded object, SetHostNames to communicate the names of the container application and container document, and Close to move an object from a running to a loaded state. Calls to all other methods are optional.
|
|
Methods in VTable order |
|
|
IUnknown Methods |
Description |
|
QueryInterface |
Returns pointers to supported interfaces. |
|
AddRef |
Increments reference count. |
|
Release |
Decrements reference count. |
|
IOleObject Methods |
Description |
|
SetClientSite |
Informs object of its client site in container. |
|
GetClientSite |
Retrieves object's client site. |
|
SetHostNames |
Communicates names of container application and container document. |
|
Close |
Moves object from running to loaded state. |
|
SetMoniker |
Informs object of its moniker. |
|
GetMoniker |
Retrieves object's moniker. |
|
InitFromData |
Initializes embedded object from selected data. |
|
GetClipboardData |
Retrieves a data transfer object from the Clipboard. |
|
DoVerb |
Invokes object to perform one of its enumerated actions ("verbs"). |
|
EnumVerbs |
Enumerates actions ("verbs") for an object. |
|
Update |
Updates an object. |
|
IsUpToDate |
Checks if object is up to date. |
|
GetUserClassID |
Returns an object's class identifier. |
|
GetUserType |
Retrieves object's user-type name. |
|
SetExtent |
Sets extent of object's display area. |
|
GetExtent |
Retrieves extent of object's display area. |
|
Advise |
Establishes advisory connection with object. |
|
Unadvise |
Destroys advisory connection with object. |
|
EnumAdvise |
Enumerates object's advisory connections. |
|
GetMiscStatus |
Retrieves status of object. |
|
SetColorScheme |
Recommends color scheme to object application. |
|
SetClientSite |
|
FUNCTION IOleObject_SetClientSite ( _ BYVAL pthis AS DWORD PTR _ , BYVAL pClientSite AS DWORD _
) AS
LONG
|
|
GetClientSite |
|
FUNCTION IOleObject_GetClientSite ( _ BYVAL pthis AS DWORD PTR _ , BYREF ppClientSite AS DWORD _
) AS
LONG
|
|
SetHostNames |
|
FUNCTION IOleObject_SetHostNames ( _ BYVAL pthis AS DWORD PTR _ , BYVAL strContainerApp AS STRING _ , BYVAL strContainerObj AS STRING _
) AS LONG strContainerApp = UCODE$(strContainerApp) & $NUL
strContainerObj = UCODE$(strContainerObj)
& $NUL
|
|
Close |
|
FUNCTION IOleObject_Close ( _ BYVAL pthis AS DWORD PTR _ , BYVAL dwSaveOption AS DWORD _
) AS LONG
|
|
SetMoniker |
|
FUNCTION IOleObject_SetMoniker ( _ BYVAL pthis AS DWORD PTR _ , BYVAL dwWhichMoniker AS DWORD _ , BYVAL pmk AS DWORD _
)
AS LONG
|
|
GetMoniker |
|
FUNCTION IOleObject_GetMoniker ( _ BYVAL pthis AS DWORD PTR _ , BYVAL dwAssign AS DWORD _ , BYVAL dwWhichMoniker AS DWORD _ , BYREF pmk AS DWORD _
)
AS LONG
|
|
InitFromData |
|
FUNCTION IOleObject_InitFromData ( _ BYVAL pthis AS DWORD PTR _ , BYVAL pDataObject AS DWORD _ , BYVAL fCreation AS LONG _ , BYVAL dwReserved AS DWORD _
)
AS LONG
|
|
GetClipboardData |
|
FUNCTION IOleObject_GetClipboardData ( _ BYVAL pthis AS DWORD PTR _ , BYVAL dwReserved AS DWORD _ , BYREF ppDataObject AS DWORD _
) AS
LONG
|
|
DoVerb |
|
FUNCTION IOleObject_DoVerb ( _ BYVAL pthis AS DWORD PTR _ , BYVAL iVerb AS LONG _ , BYREF lpMsg AS tagMsg _ , BYVAL pActiveSite AS DWORD _ , BYVAL lindex AS LONG _ , BYVAL hwndParent AS DWORD _ , BYREF lprcPosRect AS RECT _
) AS LONG
|
|
EnumVerbs |
|
FUNCTION IOleObject_EnumVerbs ( _ BYVAL pthis AS DWORD PTR _ , BYREF ppEnumOleVerb AS DWORD _
)
AS LONG
|
|
Update |
|
FUNCTION IOleObject_Update ( _ BYVAL pthis AS DWORD PTR _
) AS LONG
|
|
IsUpToDate |
|
FUNCTION IOleObject_IsUpToDate ( _ BYVAL pthis AS DWORD PTR _
) AS LONG
|
|
GetUserClassID |
|
FUNCTION IOleObject_GetUserClassID ( _ BYVAL pthis AS DWORD PTR _ , BYREF pClsid AS GUID _
) AS LONG
|
|
GetUserType |
|
DECLARE FUNCTION Proto_IOleObject_GetUserType ( _ BYVAL pthis AS DWORD PTR _ , BYVAL dwFormOfType AS DWORD _ , BYREF pszUserType AS DWORD _
)
AS LONG FUNCTION IOleObject_GetUserType ( _ BYVAL pthis AS DWORD PTR _ , BYVAL dwFormOfType AS DWORD _ , BYREF strUserType AS STRING _
)
AS LONG LOCAL bstrlen AS LONG
LOCAL
pszUserType AS DWORD
|
|
SetExtent |
|
FUNCTION IOleObject_SetExtent ( _ BYVAL pthis AS DWORD PTR _ , BYVAL dwDrawAspect AS DWORD _ , BYREF psizel AS SIZEL _
)
AS LONG
|
|
GetExtent |
|
FUNCTION IOleObject_GetExtent ( _ BYVAL pthis AS DWORD PTR _ , BYVAL dwDrawAspect AS DWORD _ , BYREF psizel AS SIZEL _
)
AS LONG
|
|
Advise |
|
FUNCTION IOleObject_Advise ( _ BYVAL pthis AS DWORD PTR _ , BYVAL pAdvSink AS DWORD _ , BYREF pdwConnection AS DWORD _
)
AS LONG
|
|
UnAdvise |
|
FUNCTION IOleObject_Unadvise ( _ BYVAL pthis AS DWORD PTR _ , BYVAL dwConnection AS DWORD _
) AS
LONG
|
|
EnumAdvise |
|
FUNCTION IOleObject_EnumAdvise ( _ BYVAL pthis AS DWORD PTR _ , BYREF ppenumAdvise AS DWORD _ ) AS LONG
|
|
GetMiscStatus |
|
FUNCTION IOleObject_GetMiscStatus ( _ BYVAL pthis AS DWORD PTR _ , BYVAL dwAspect AS DWORD _ , BYREF pdwStatus AS DWORD _
) AS
LONG
|
|
SetColorScheme |
|
FUNCTION IOleObject_SetColorScheme ( _ BYVAL pthis AS DWORD PTR _ , BYREF pLogPal AS LOGPALETTE _
) AS
LONG
|
|
IOleObject interface implementation |
$IID_IOleObject = GUID$("{00000112-0000-0000-C000-000000000046}")
' ****************************************************************************************
' IOleObject interface
' ****************************************************************************************
TYPE IOleObjectVtbl
' IUnknown methods
pQueryInterface AS DWORD ' // QueryInterface method
pAddRef AS DWORD ' // AddRef method
pRelease AS DWORD ' // Release method
' IOleObject members
pSetClientSite AS DWORD ' // SetClientSite method
pGetClientSite AS DWORD ' // GetClientSite method
pSetHostNames AS DWORD ' // SetHostNames method
pClose AS DWORD ' // Close method
pSetMoniker AS DWORD ' // SetMoniker method
pGetMoniker AS DWORD ' // GetMoniker method
pInitFromData AS DWORD ' // InitFromData method
pGetClipboardData AS DWORD ' // GetClipboardData method
pDoVerb AS DWORD ' // DoVerb method
pEnumVerbs AS DWORD ' // EnumVerbs method
pUpdate AS DWORD ' // Update method
pIsUpToDate AS DWORD ' // IsUpToDate method
pGetUserClassID AS DWORD ' // GetUserClassID method
pGetUserType AS DWORD ' // GetUserType method
pSetExtent AS DWORD ' // SetExtent method
pGetExtent AS DWORD ' // GetExtent method
pAdvise AS DWORD ' // Advise method
pUnadvise AS DWORD ' // Unadvise method
pEnumAdvise AS DWORD ' // EnumAdvise method
pGetMiscStatus AS DWORD ' // GetMiscStatus method
pSetColorScheme AS DWORD ' // SetColorScheme method
' Custom data
pVtblAddr AS DWORD ' // Address of the virtual table
cRef AS DWORD ' // Reference count
END TYPE
' ****************************************************************************************
' ****************************************************************************************
' Builds the IOleObject Virtual Table
' Returns a cookie that is a pointer to a IOleObjectVtbl structure.
' ****************************************************************************************
FUNCTION IOleObject_BuildVtbl () AS DWORD
LOCAL pVtbl AS IOleObjectVtbl PTR
LOCAL pUnk AS IOleObjectVtbl PTR
pVtbl = HeapAlloc(GetProcessHeap(), %HEAP_ZERO_MEMORY, SIZEOF(@pVtbl))
IF pVtbl = 0 THEN EXIT FUNCTION
@pVtbl.pQueryInterface = CODEPTR(IOleObject_QueryInterface)
@pVtbl.pAddRef = CODEPTR(IOleObject_AddRef)
@pVtbl.pRelease = CODEPTR(IOleObject_Release)
@pVtbl.pSetClientSite = CODEPTR(IOleObject_SetClientSite)
@pVtbl.pGetClientSite = CODEPTR(IOleObject_GetClientSite)
@pVtbl.pSetHostNames = CODEPTR(IOleObject_SetHostNames)
@pVtbl.pClose = CODEPTR(IOleObject_Close)
@pVtbl.pSetMoniker = CODEPTR(IOleObject_SetMoniker)
@pVtbl.pGetMoniker = CODEPTR(IOleObject_GetMoniker)
@pVtbl.pInitFromData = CODEPTR(IOleObject_InitFromData)
@pVtbl.pGetClipboardData = CODEPTR(IOleObject_GetClipboardData)
@pVtbl.pDoVerb = CODEPTR(IOleObject_DoVerb)
@pVtbl.pEnumVerbs = CODEPTR(IOleObject_EnumVerbs)
@pVtbl.pUpdate = CODEPTR(IOleObject_Update)
@pVtbl.pIsUpToDate = CODEPTR(IOleObject_IsUpToDate)
@pVtbl.pGetUserClassID = CODEPTR(IOleObject_GetUserClassID)
@pVtbl.pGetUserType = CODEPTR(IOleObject_GetUserType)
@pVtbl.pSetExtent = CODEPTR(IOleObject_SetExtent)
@pVtbl.pGetExtent = CODEPTR(IOleObject_GetExtent)
@pVtbl.pAdvise = CODEPTR(IOleObject_Advise)
@pVtbl.pUnadvise = CODEPTR(IOleObject_Unadvise)
@pVtbl.pEnumAdvise = CODEPTR(IOleObject_EnumAdvise)
@pVtbl.pGetMiscStatus = CODEPTR(IOleObject_GetMiscStatus)
@pVtbl.pSetColorScheme = CODEPTR(IOleObject_SetColorScheme)
@pVtbl.pVtblAddr = pVtbl
@pVtbl.cRef = 1
pUnk = VARPTR(@pVtbl.pVtblAddr)
FUNCTION = pUnk
END FUNCTION
' ****************************************************************************************
' ****************************************************************************************
' IOleObject_QueryInterface method
' Returns the IUnknown of our class and increments the reference counter.
' ****************************************************************************************
FUNCTION IOleObject_QueryInterface (BYVAL pCookie AS IOleObjectVtbl PTR, BYREF riid AS GUID, BYREF ppvObj AS DWORD) AS LONG
IF riid = $IID_IOleObject THEN
ppvObj = pCookie
INCR @@pCookie.cRef
FUNCTION = %S_OK
ELSE
FUNCTION = %E_NOINTERFACE
END IF
END FUNCTION
' ****************************************************************************************
' ****************************************************************************************
' IOleObject_AddRef method
' Increments the reference counter.
' ****************************************************************************************
FUNCTION IOleObject_AddRef (BYVAL pCookie AS IOleObjectVtbl PTR) AS DWORD
INCR @@pCookie.cRef
FUNCTION = @@pCookie.cRef
END FUNCTION
' ****************************************************************************************
' ****************************************************************************************
' IOleObject_Release method
' Releases our class if there is only a reference to him and decrements the reference counter.
' ****************************************************************************************
FUNCTION IOleObject_Release (BYVAL pCookie AS IOleObjectVtbl PTR) AS DWORD
DECR @@pCookie.cRef
FUNCTION = @@pCookie.cRef
IF @@pCookie.cRef = 0 THEN
IF ISTRUE @@pCookie.pVtblAddr THEN
HeapFree(GetProcessHeap(), 0, BYVAL @@pCookie.pVtblAddr)
END IF
END IF
END FUNCTION
' ****************************************************************************************
' ****************************************************************************************
' Informs object of its client site in container.
' ****************************************************************************************
FUNCTION IOleObject_SetClientSite (BYVAL pCookie AS IOleObjectVtbl PTR, BYVAL pClientSite AS DWORD) AS LONG
' Put your code here
END FUNCTION
' ****************************************************************************************
' ****************************************************************************************
' Retrieves object's client site.
' ****************************************************************************************
FUNCTION IOleObject_GetClientSite (BYVAL pCookie AS IOleObjectVtbl PTR, BYREF ppClientSite AS DWORD) AS LONG
' Put your code here
END FUNCTION
' ****************************************************************************************
' ****************************************************************************************
' Communicates names of container application and container document.
' ****************************************************************************************
FUNCTION IOleObject_SetHostNames (BYVAL pCookie AS IOleObjectVtbl PTR, BYVAL szContainerApp AS DWORD, BYVAL szContainerObj AS DWORD) AS LONG
' Put your code here
END FUNCTION
' ****************************************************************************************
' ****************************************************************************************
' Moves object from running to loaded state.
' ****************************************************************************************
FUNCTION IOleObject_Close (BYVAL pCookie AS IOleObjectVtbl PTR, BYVAL dwSaveOption AS DWORD) AS LONG
' Put your code here
END FUNCTION
' ****************************************************************************************
' ****************************************************************************************
' Informs object of its moniker.
' ****************************************************************************************
FUNCTION IOleObject_SetMoniker (BYVAL pCookie AS IOleObjectVtbl PTR, BYVAL dwWhichMoniker AS DWORD, BYVAL pmk AS DWORD) AS LONG
' Put your code here
END FUNCTION
' ****************************************************************************************
' ****************************************************************************************
' Retrieves object's moniker.
' ****************************************************************************************
FUNCTION IOleObject_GetMoniker (BYVAL pCookie AS IOleObjectVtbl PTR, BYVAL dwAssign AS DWORD, BYVAL dwWhichMoniker AS DWORD, BYREF pmk AS DWORD) AS LONG
' Put your code here
END FUNCTION
' ****************************************************************************************
' ****************************************************************************************
' Initializes embedded object from selected data.
' ****************************************************************************************
FUNCTION IOleObject_InitFromData (BYVAL pCookie AS IOleObjectVtbl PTR, BYVAL pDataObject AS DWORD, BYVAL fCreation AS LONG, BYVAL dwReserved AS DWORD) AS LONG
' Put your code here
END FUNCTION
' ****************************************************************************************
' ****************************************************************************************
' Retrieves a data transfer object from the Clipboard.
' ****************************************************************************************
FUNCTION IOleObject_GetClipboardData (BYVAL pCookie AS IOleObjectVtbl PTR, BYVAL dwReserved AS DWORD, BYREF ppDataObject AS DWORD) AS LONG
' Put your code here
END FUNCTION
' ****************************************************************************************
' ****************************************************************************************
' Invokes object to perform one of its enumerated actions ("verbs").
' ****************************************************************************************
FUNCTION IOleObject_DoVerb (BYVAL pCookie AS IOleObjectVtbl PTR, BYVAL iVerb AS LONG, BYREF lpMsg AS tagMsg, BYVAL pActiveSite AS DWORD, BYVAL lindex AS LONG, BYVAL hwndParent AS DWORD, BYREF lprcPosRect AS RECT) AS LONG
' Put your code here
END FUNCTION
' ****************************************************************************************
' ****************************************************************************************
' Enumerates actions ("verbs") for an object.
' ****************************************************************************************
FUNCTION IOleObject_EnumVerbs (BYVAL pCookie AS IOleObjectVtbl PTR, BYREF ppEnumOleVerb AS DWORD) AS LONG
' Put your code here
END FUNCTION
' ****************************************************************************************
' ****************************************************************************************
' Updates an object.
' ****************************************************************************************
FUNCTION IOleObject_Update (BYVAL pCookie AS IOleObjectVtbl PTR) AS LONG
' Put your code here
END FUNCTION
' ****************************************************************************************
' ****************************************************************************************
' Checks if object is up to date.
' ****************************************************************************************
FUNCTION IOleObject_IsUpToDate (BYVAL pCookie AS IOleObjectVtbl PTR) AS LONG
' Put your code here
END FUNCTION
' ****************************************************************************************
' ****************************************************************************************
' Returns an object's class identifier.
' ****************************************************************************************
FUNCTION IOleObject_GetUserClassID (BYVAL pCookie AS IOleObjectVtbl PTR, BYREF pClsid AS GUID) AS LONG
' Put your code here
END FUNCTION
' ****************************************************************************************
' ****************************************************************************************
' Retrieves object's user-type name.
' ****************************************************************************************
FUNCTION IOleObject_GetUserType (BYVAL pCookie AS IOleObjectVtbl PTR, BYVAL dwFormOfType AS DWORD, BYREF pszUserType AS DWORD) AS LONG
' Put your code here
END FUNCTION
' ****************************************************************************************
' ****************************************************************************************
' Sets extent of object's display area
' ****************************************************************************************
FUNCTION IOleObject_SetExtent (BYVAL pCookie AS IOleObjectVtbl PTR, BYVAL dwDrawAspect AS DWORD, BYREF psizel AS SIZEL) AS LONG
' Put your code here
END FUNCTION
' ****************************************************************************************
' ****************************************************************************************
' Retrieves extent of object's display area.
' ****************************************************************************************
FUNCTION IOleObject_GetExtent (BYVAL pCookie AS IOleObjectVtbl PTR, BYVAL dwDrawAspect AS DWORD, BYREF psizel AS SIZEL) AS LONG
' Put your code here
END FUNCTION
' ****************************************************************************************
' ****************************************************************************************
' Establishes advisory connection with object.
' ****************************************************************************************
FUNCTION IOleObject_Advise (BYVAL pCookie AS IOleObjectVtbl PTR, BYVAL pAdvSink AS DWORD, BYREF pdwConnection AS DWORD) AS LONG
' Put your code here
END FUNCTION
' ****************************************************************************************
' ****************************************************************************************
' Destroys advisory connection with object.
' ****************************************************************************************
FUNCTION IOleObject_Unadvise (BYVAL pCookie AS IOleObjectVtbl PTR, BYVAL dwConnection AS DWORD) AS LONG
' Put your code here
END FUNCTION
' ****************************************************************************************
' ****************************************************************************************
' Enumerates object's advisory connections.
' ****************************************************************************************
FUNCTION IOleObject_EnumAdvise (BYVAL pCookie AS IOleObjectVtbl PTR, BYREF ppenumAdvise AS DWORD) AS LONG
' Put your code here
END FUNCTION
' ****************************************************************************************
' ****************************************************************************************
' Retrieves status of object.
' ****************************************************************************************
FUNCTION IOleObject_GetMiscStatus (BYVAL pCookie AS IOleObjectVtbl PTR, BYVAL dwAspect AS DWORD, BYREF pdwStatus AS DWORD) AS LONG
' Put your code here
END FUNCTION
' ****************************************************************************************
' ****************************************************************************************
' Recommends color scheme to object application.
' ****************************************************************************************
FUNCTION IOleObject_SetColorScheme (BYVAL pCookie AS IOleObjectVtbl PTR, BYREF pLogPal AS LOGPALETTE) AS LONG
' Put your code here
END FUNCTION
' ****************************************************************************************
|
Page last updated on Sunday, 04 June 2006 14:29:35 +0200