|
|
|
IHTMLEditHost2 Interface |
|
IID_IHTMLEditHost2 |
{3050F848-98B5-11CF-BB82-00AA00BDCE0D} |
|
This interface extends IHTMLEditHost with a method that enables you to intercept drag-and-drop operations at a stage earlier than the ondragstart event.
|
|
Methods in VTable order |
|
|
IUnknown Methods |
Description |
|
QueryInterface |
Returns pointers to supported interfaces. |
|
AddRef |
Increments reference count. |
|
Release |
Decrements reference count. |
|
IHTMLEditHost Method |
Description |
|
SnapRect |
Called by MSHTML whenever a selected element is resized or moved in the editor. |
|
IHTMLEditHost2 Method |
Description |
|
PreDrag |
Called by MSHTML before an ondragstart event fires on a selected element in the editor, and before the element is cloned prior to a drag-and-drop operation. |
|
ITMLEditHost2 interface implementation |
$IID_IHTMLEditHost2 = GUID$("{3050F848-98B5-11CF-BB82-00AA00BDCE0D}")
' ****************************************************************************************
' IHTMLEditHost2 interface virtual table
' ****************************************************************************************
TYPE IHTMLEditHost2Vtbl
' IUnknown methods
pQueryInterface AS DWORD ' // QueryInterface method
pAddRef AS DWORD ' // AddRef method
pRelease AS DWORD ' // Release method
' IHTMLEditHost2 method
pSnapRect AS DWORD ' // SnapRect method
pPreDrag AS DWORD ' // PreDrag method
' Custom data
pVtblAddr AS DWORD ' // Address of the virtual table
cRef AS DWORD ' // Reference count
END TYPE
' ****************************************************************************************
' ****************************************************************************************
' Builds the IHTMLEditHost2 Virtual Table
' Returns a cookie that is a pointer to a IHTMLEditHost2Vtbl structure.
' ****************************************************************************************
FUNCTION IHTMLEditHost2_BuildVtbl () AS DWORD
LOCAL pVtbl AS IHTMLEditHost2Vtbl PTR
LOCAL pUnk AS IHTMLEditHost2Vtbl PTR
pVtbl = HeapAlloc(GetProcessHeap(), %HEAP_ZERO_MEMORY, SIZEOF(@pVtbl))
IF pVtbl = 0 THEN EXIT FUNCTION
@pVtbl.pQueryInterface = CODEPTR(IHTMLEditHost2_QueryInterface)
@pVtbl.pAddRef = CODEPTR(IHTMLEditHost2_AddRef)
@pVtbl.pRelease = CODEPTR(IHTMLEditHost2_Release)
@pVtbl.pSnapRect = CODEPTR(IHTMLEditHost2_SnapRect)
@pVtbl.pPreDrag = CODEPTR(IHTMLEditHost2_PreDrag)
@pVtbl.pVtblAddr = pVtbl
@pVtbl.cRef = 1
pUnk = VARPTR(@pVtbl.pVtblAddr)
FUNCTION = pUnk
END FUNCTION
' ****************************************************************************************
' ****************************************************************************************
' IHTMLEditHost2_QueryInterface method
' Returns the IUnknown of our class and increments the reference counter.
' ****************************************************************************************
FUNCTION IHTMLEditHost2_QueryInterface (BYVAL pCookie AS IHTMLEditHost2Vtbl PTR, BYREF riid AS GUID, BYREF ppvObj AS DWORD) AS LONG
IF riid = $IID_IHTMLEditHost2 THEN
ppvObj = pCookie
INCR @@pCookie.cRef
FUNCTION = %S_OK
ELSE
FUNCTION = %E_NOINTERFACE
END IF
END FUNCTION
' ****************************************************************************************
' ****************************************************************************************
' IHTMLEditHost2_IUnknown_AddRef method
' Increments the reference counter.
' ****************************************************************************************
FUNCTION IHTMLEditHost2_AddRef (BYVAL pCookie AS IHTMLEditHost2Vtbl PTR) AS DWORD
INCR @@pCookie.cRef
FUNCTION = @@pCookie.cRef
END FUNCTION
' ****************************************************************************************
' ****************************************************************************************
' IHTMLEditHost2_IUnknown_Release method
' Releases our class if there is only a reference to him and decrements the reference counter.
' ****************************************************************************************
FUNCTION IHTMLEditHost2_Release (BYVAL pCookie AS IHTMLEditHost2Vtbl 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
' ****************************************************************************************
' ****************************************************************************************
' Called by MSHTML whenever a selected element is resized or moved in the editor.
' ****************************************************************************************
FUNCTION IHTMLEditHost2_SnapRect ( _
BYVAL pCookie AS IHTMLEditHost2Vtbl PTR _
, BYVAL pIElement AS DWORD _
, BYREF prcNew AS RECT _
, BYVAL eHandle AS LONG _
) AS LONG
' Put your code here
' FUNCTION = %S_OK or an error value
END FUNCTION
' ****************************************************************************************
' ****************************************************************************************
' Called by MSHTML before an ondragstart event fires on a selected element in the editor,
' and before the element is cloned prior to a drag-and-drop operation.
' ****************************************************************************************
FUNCTION IHTMLEditHost2_PreDrag ( _
BYVAL pCookie AS IHTMLEditHost2Vtbl PTR _
) AS LONG
' Put your code here
' FUNCTION = %S_OK or an error value
END FUNCTION
' ****************************************************************************************
|
Page last updated on Monday, 03 April 2006 19:56:39 +0200