13 Shared Methods of the Com Interface
Private Shared Function U_QueryInterface(pIRichEditOleCallback as ptr, riid As Ptr, byref out As Ptr) As Integer
#Pragma X86CallingConvention StdCall
return S_OK
End Function
[code]Private Shared Function U_AddRef(pIRichEditOleCallback as ptr) As Integer
#Pragma X86CallingConvention StdCall
Declare Function InterlockedIncrement Lib “kernel32” (lpAddend As ptr) As integer
Dim i_pcount as integer = integer(pIRichEditOleCallback ) + 4
Dim m_count as new MemoryBlock(4)
m_count.Int32Value(0) = i_pcount
Dim pcount as Ptr = m_count.Ptr(0)
’ We want to increment the Reference Count
return InterlockedIncrement (pcount)
End Function[/code]
[code]Private Shared Function U_Release(pIRichEditOleCallback as ptr) As Integer
#Pragma X86CallingConvention StdCall
Declare Function InterlockedDecrement Lib “kernel32” (lpAddend As ptr) As integer
Dim rc as Integer
Dim i_pcount as integer = integer(pIRichEditOleCallback ) + 4
Dim m_count as new MemoryBlock(4)
m_count.Int32Value(0) = i_pcount
Dim pcount as Ptr = m_count.Ptr(0)
’ We want to decrement the Reference Count
rc = InterlockedDecrement (pcount)
if rc=0 then
pIRichEditOleCallback = Nil
return 1
else
return 0
end if
End Function[/code]
Private Shared Function IR_GetContextMenu(pIRichEditOleCallback as ptr, ByVal SelType As Integer, ByVal lpoleobj As ptr, lpchrg As integer, lphmenu As Integer) As integer
' Queries the application for a context menu to use on a right mouse down
#Pragma X86CallingConvention StdCall
return E_NOTIMPL
End Function
Private Shared Function IR_QueryInsertObject(pIRichEditOleCallback as ptr, lpclsid as integer, lpstg as integer, cp as Integer) As Integer
' Queries the application as to whether an object should be inserted.
#Pragma X86CallingConvention StdCall
return S_OK ' Yes, we'd love to have this object inserted
End Function
[code]Private Shared Function IR_GetNewStorage(pIRichEditOleCallback as ptr, byref lplpstg As ptr) As integer
’ Get storage interface for a new object
#Pragma X86CallingConvention StdCall
const STGM_READWRITE = &h2
const STGM_SHARE_EXCLUSIVE = &h10
const STGM_CREATE = &h1000
’ This function creates a byte array object based on global memory
Declare Function CreateILockBytesOnHGlobal LIB “OLE32.DLL” ALIAS “CreateILockBytesOnHGlobal” _
(hGlobal AS Integer, BYVAL fDeleteOnRelease AS Boolean, Byref ppLkbyt AS Ptr) As Integer
’ This function creates and opens a new compound file storage object on top of a byte array object provided by the caller
Declare Function StgCreateDocfileOnILockBytes LIB “OLE32.DLL” ALIAS “StgCreateDocfileOnILockBytes” _
(plkbyt AS Ptr, BYVAL grfMode AS Integer, BYVAL reserved AS Integer, Byref ppstgOpen AS Ptr) AS Integer
Dim rc as Integer
Dim pILockBytes as Ptr
rc = CreateILockBytesOnHGlobal (0, true, pILockBytes)
If rc <> S_OK then return rc
rc = StgCreateDocfileOnILockBytes (pILockBytes, STGM_SHARE_EXCLUSIVE + _ STGM_READWRITE + STGM_CREATE, 0, lplpstg)
return rc
End Function[/code]
Private Shared Function IR_GetClipboardData(pIRichEditOleCallback as ptr, lpchrg As integer, ByVal reco As Integer, lplpdataobj As Ptr) As integer
' Allows the client to supply its own clipboard object
#Pragma X86CallingConvention StdCall
return E_NOTIMPL
End Function
Private Shared Function IR_QueryAcceptData(pIRichEditOleCallback as ptr, ByVal lpdataobj As ptr, lpcfFormat As Integer, ByVal reco As Integer, ByVal fReally As Integer, ByVal hMetaPict As Integer) As Integer
' Called on a paste or drag to determine if the data pasted/dragged should be accepted
#Pragma X86CallingConvention StdCall
return E_NOTIMPL
End Function
Private Shared Function IR_GetDragDropEffect(pIRichEditOleCallback as ptr, ByVal fDrag As Integer, ByVal grfKeyState As Integer, pdwEffect As Integer) As integer
' Allows the client to specify the effects of a drop operation
#Pragma X86CallingConvention StdCall
return E_NOTIMPL
End Function
Private Shared Function IR_DeleteObject(pIRichEditOleCallback as ptr, ByVal lpoleobj As ptr) As Integer
' Notification that an object is about to be deleted from a rich edit control
#Pragma X86CallingConvention StdCall
return E_NOTIMPL
End Function
Private Shared Function IR_GetInPlaceContext (pIRichEditOleCallback as ptr, lplpFrame As ptr, lplpDoc As ptr, lpFrameInfo As ptr) As Integer
#Pragma X86CallingConvention StdCall
return E_NOTIMPL
End Function
Private Shared Function IR_ShowContainerUI(pIRichEditOleCallback as ptr, ByVal fShow As Integer) As Integer
' Tells the application whether to display its container user interface
#Pragma X86CallingConvention StdCall
return E_NOTIMPL
End Function
Private Shared Function IR_ContextSensitiveHelp(pIRichEditOleCallback as ptr, ByVal fEnterMode As Integer) As Integer
' Tells the application that it should transition into or out of context sensitive help mode
#Pragma X86CallingConvention StdCall
return E_NOTIMPL
End Function