IHTMLPopup
Posted: Tue Jul 19, 2005 12:29 am
Did someone ever successfully use the IHTMLPopup interface?
This is as far as I got..
This is as far as I got..
Code: Select all
#VT_DISPATCH = 9
Structure VARIANT
vt.w
wReserved1.w
wReserved2.w
wReserved3.w
StructureUnion
pdispVal.l
EndStructureUnion
EndStructure
Procedure WCHAR(st$)
blen = (Len(st$) * 2) + 10
wbuf = AllocateMemory(blen)
MultiByteToWideChar_(#CP_ACP, 0, st$, -1, wbuf, blen)
ProcedureReturn wbuf
EndProcedure
Procedure BSTR(st$)
wst = WCHAR(st$)
bstr = SysAllocString_(wst)
FreeMemory(wst)
ProcedureReturn bstr
EndProcedure
If OpenWindow(0,0,0,600,300,#PB_Window_SystemMenu|#PB_Window_ScreenCentered,"WebGadget") And CreateGadgetList(WindowID(0))
WebGadget(0,10,10,580,280,"http://www.purebasic.com")
WebObject.IWebBrowser2 = GetWindowLong_(GadgetID(0), #GWL_USERDATA)
Repeat
event = WaitWindowEvent()
WebObject\get_Busy(@isBusy)
If isBusy = 0 And done = 0
WebObject\get_document(@DocDispatch.IDispatch)
DocDispatch\QueryInterface(?IID_IHTMLDocument2, @Document.IHTMLDocument2)
Document\get_parentWindow(@Window.IHTMLWindow2)
Window\QueryInterface(?IID_IHTMLWindow4, @Window4.IHTMLWindow4)
Window4\createPopup(@v.VARIANT, @Dispatch2.IDispatch)
Dispatch2\QueryInterface(?IID_IHTMLPopup, @Popup.IHTMLPopup)
Popup\get_document(@PopupDoc.IHTMLDocument)
PopupDoc\QueryInterface(?IID_IHTMLDocument2, @PopupDoc2.IHTMLDocument2)
PopupDoc2\get_body(@PopupElem.IHTMLElement)
PopupElem\get_Style(@PopupStyle.IHTMLStyle)
PopupStyle\put_border(BSTR("solid black 1px"))
PopupElem\put_innerHTML(BSTR("<b>hello</b>"))
;From this point I do not know what I'm doing, because I don't understand the
;documentation for IHTMLPopup::Show (the usual VARIANT stuff..)
Document\get_body(@DocElem.IHTMLElement)
v.VARIANT
v\vt = #VT_DISPATCH
v\pdispVal = @DocElem
Popup\show(100, 100, 100, 100, @v)
done = 1
EndIf
Until event =#PB_Event_CloseWindow
EndIf
DataSection
IID_IHTMLDocument2:
Data.l $332c4425
Data.w $26cb, $11d0
Data.b $b4, $83, $00, $c0, $4f, $d9, $01, $19
IID_IHTMLWindow4:
Data.l $3050F6CF
Data.w $98B5, $11CF
Data.b $BB, $82, $00, $AA, $00, $BD, $CE, $0B
IID_IHTMLPopup:
Data.l $3050F666
Data.w $98B5, $11CF
Data.b $BB, $82, $00, $AA, $00, $BD, $CE, $0B
IID_IDispatch:
Data.l $00020400
Data.w $0000, $0000
Data.b $C0, $00, $00, $00, $00, $00, $00, $46
EndDataSection