Hi,
Can anybody tell me what I am doing wrong ,
The following code is supposed to give me pointer to the IPicture interface from an Image control in my userform but fails ...
BTW, i am using the low level DispCallFunc api in the vtblCall routine .
I have also tried getting the IPictureDisp interface but without any luck.
I get -2147467262 "No such interface supported" however, I know the Image control DOES implement the IPicture interface ... I am confused !
Can anybody tell me what I am doing wrong ,
The following code is supposed to give me pointer to the IPicture interface from an Image control in my userform but fails ...
BTW, i am using the low level DispCallFunc api in the vtblCall routine .
I have also tried getting the IPictureDisp interface but without any luck.
Code:
Sub Test()
Const CC_STDCALL As Long = 4
Const S_OK As Long = 0
Const IUnknownQueryInterface = 0
Const IUnknownRelease = 8
Const IPicture_interface = "{7bf80980-bf32-101a-8bbb-00aa00300cab}" 'IPicture uuid
'Const IPictureDisp_interface = "{7bf80981-bf32-101a-8bbb-00aa00300cab}" ' IPictureDisp uuid
Dim uGUID(0 To 3) As Long
Dim pUnk As Long, pPicInterFace As Long
If IIDFromString(StrPtr(IPicture_interface), VarPtr(uGUID(0))) = S_OK Then
pUnk = ObjPtr(Me.Image1)
If vtblCall(pUnk, IUnknownQueryInterface, vbLong, CC_STDCALL, VarPtr(uGUID(0)), VarPtr(pPicInterFace)) = S_OK Then
MsgBox pPicInterFace '<== code never reaches this point !!
vtblCall pPicInterFace, IUnknownRelease, vbLong, CC_STDCALL
End If
End If
End Sub