|
|
|
IOleWindow Interface |
|
IID_IOleWindow |
{00000114-0000-0000-C000-000000000046} |
|
The IOleWindow interface provides methods that allow an application to obtain the handle to the various windows that participate in in-place activation, and also to enter and exit context-sensitive help mode.
Several other in-place activation interfaces are derived from the IOleWindow interface. Containers and objects must implement and use these interfaces in order to support in-place activation.
Use this interface to obtain the window handle to the windows associated with in-place activation (frame, document, parent, and in-place object). It is also used to enter and exit context-sensitive help.
|
|
Methods in VTable order |
|
|
IUnknown Methods |
Description |
|
QueryInterface |
Returns pointers to supported interfaces. |
|
AddRef |
Increments reference count. |
|
Release |
Decrements reference count. |
|
IOleWindow Methods |
Description |
|
GetWindow |
Gets a window handle. |
|
ContextSensitiveHelp |
Controls enabling of context-sensitive help. |
|
GetWindow |
|
FUNCTION IOleWindow_GetWindow ( _ BYVAL pthis AS DWORD PTR _ , BYREF phwnd AS DWORD _
) AS LONG
|
|
ContextSensitiveHelp |
|
FUNCTION IOleWindow_ContextSensitiveHelp ( _ BYVAL pthis AS DWORD PTR _ , BYVAL fEnterMode AS LONG _
) AS
LONG
|
|
IOleWindow interface implementation |
$IID_IOleWindow = GUID$("{00000114-0000-0000-C000-000000000046}")
' ****************************************************************************************
' IOleWindow interface
' ****************************************************************************************
TYPE IOleWindowVtbl
' IUnknown methods
pQueryInterface AS DWORD ' // QueryInterface method
pAddRef AS DWORD ' // AddRef method
pRelease AS DWORD ' // Release method
' IOleWindow members
pGetWindow AS DWORD ' // GetWindow method
pContextSensitiveHelp AS DWORD ' // GetWindow method
' Custom data
pVtblAddr AS DWORD ' // Address of the virtual table
cRef AS DWORD ' // Reference count
END TYPE
' ****************************************************************************************
' ****************************************************************************************
' Builds the IOleWindow Virtual Table
' Returns a cookie that is a pointer to a IOleWindowVtbl structure.
' ****************************************************************************************
FUNCTION IOleWindow_BuildVtbl () AS DWORD
LOCAL pVtbl AS IOleWindowVtbl PTR
LOCAL pUnk AS IOleWindowVtbl PTR
pVtbl = HeapAlloc(GetProcessHeap(), %HEAP_ZERO_MEMORY, SIZEOF(@pVtbl))
IF pVtbl = 0 THEN EXIT FUNCTION
@pVtbl.pQueryInterface = CODEPTR(IOleWindow_QueryInterface)
@pVtbl.pAddRef = CODEPTR(IOleWindow_AddRef)
@pVtbl.pRelease = CODEPTR(IOleWindow_Release)
@pVtbl.pGetWindow = CODEPTR(IOleWindow_GetWindow)
@pVtbl.pContextSensitiveHelp = CODEPTR(IOleWindow_ContextSensitiveHelp)
@pVtbl.pVtblAddr = pVtbl
@pVtbl.cRef = 1
pUnk = VARPTR(@pVtbl.pVtblAddr)
FUNCTION = pUnk
END FUNCTION
' ****************************************************************************************
' ****************************************************************************************
' IOleWindow_QueryInterface method
' Returns the IUnknown of our class and increments the reference counter.
' ****************************************************************************************
FUNCTION IOleWindow_QueryInterface (BYVAL pCookie AS IOleWindowVtbl PTR, BYREF riid AS GUID, BYREF ppvObj AS DWORD) AS LONG
IF riid = $IID_IOleWindow THEN
ppvObj = pCookie
INCR @@pCookie.cRef
FUNCTION = %S_OK
ELSE
FUNCTION = %E_NOINTERFACE
END IF
END FUNCTION
' ****************************************************************************************
' ****************************************************************************************
' IOleWindow_AddRef method
' Increments the reference counter.
' ****************************************************************************************
FUNCTION IOleWindow_AddRef (BYVAL pCookie AS IOleWindowVtbl PTR) AS DWORD
INCR @@pCookie.cRef
FUNCTION = @@pCookie.cRef
END FUNCTION
' ****************************************************************************************
' ****************************************************************************************
' IOleWindow_Release method
' Releases our class if there is only a reference to him and decrements the reference counter.
' ****************************************************************************************
FUNCTION IOleWindow_Release (BYVAL pCookie AS IOleWindowVtbl 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
' ****************************************************************************************
' ****************************************************************************************
' Gets a window handle.
' ****************************************************************************************
FUNCTION IOleWindow_GetWindow (BYVAL pCookie AS IOleWindowVtbl PTR, BYREF phwnd AS DWORD) AS LONG
' Put your code here
END FUNCTION
' ****************************************************************************************
' ****************************************************************************************
' Controls enabling of context-sensitive help.
' ****************************************************************************************
FUNCTION IOleWindow_ContextSensitiveHelp (BYVAL pCookie AS IOleWindowVtbl PTR, BYVAL fEnterMode AS LONG) AS LONG
' Put your code here
END FUNCTION
' ****************************************************************************************
|
Page last updated on Monday, 03 April 2006 20:33:37 +0200