I now propose to the problem, and before the issue is absolutely not the same,
No previous use of threads.
Now the use of the thread.
trouble you to help solve the problem.
This problem has been bothering the good days.
Code: Select all
Enumeration
#Web_0
#Panel_0
#Window_0
EndEnumeration
Declare Main()
Declare WebBrowser_(INT.l)
Declare.l WebBrowser_Refresh(Gadget.l)
;-
Procedure WebBrowser_(INT.l)
Url.s = PeekS(INT)
If OpenWindow(#Window_0,#Null,#Null,1000,700,#NULL$,#PB_Window_SystemMenu)
If CreateGadgetList(WindowID(#Window_0))
PanelGadget(#Panel_0,#Null,#Null,1000,700)
AddGadgetItem(#Panel_0,1,"Ok")
WebGadget(#Web_0,#Null,#Null,WindowWidth(#Window_0)-3,WindowHeight(#Window_0)-22,Url)
CloseGadgetList()
EndIf
Repeat
Until WaitWindowEvent() = #PB_Event_CloseWindow
EndIf
EndProcedure
;-
Procedure.l WebBrowser_Refresh(Gadget.l)
CoInitialize_(#Null)
Res.l = #False
IWebBrowser2.IWebBrowser2 = GetWindowLong_(GadgetID(Gadget),#GWL_USERDATA)
IDispatch.IDispatch = #Null
IHTMLDocument2.IHTMLDocument2 = #Null
If IWebBrowser2
If IWebBrowser2\get_Document(@IDispatch) = #S_OK And IDispatch
If IDispatch\QueryInterface(?IID_IHTMLDocument2,@IHTMLDocument2) = #S_OK And IHTMLDocument2
If IHTMLDocument2\execCommand("Refresh",#VARIANT_TRUE,@VAR.VARIANT,@pfRet) = #S_OK
Res = #True
EndIf
IHTMLDocument2\Release()
EndIf
IDispatch\Release()
EndIf
EndIf
CoUninitialize_()
ProcedureReturn Res
EndProcedure
DataSection
IID_IHTMLDocument2:
Data.l $332C4425
Data.w $26CB, $11D0
Data.b $B4, $83, $00, $C0, $4F, $D9, $01, $19
EndDataSection
;-
Procedure Main()
While #True
Url.s = "about:blank"
Thread.l = CreateThread(@WebBrowser_(),@Url)
Sleep_(1000*5)
Debug WebBrowser_Refresh(#Web_0)
Sleep_(1000*5)
KillThread(Thread)
Wend
EndProcedure
WaitThread(CreateThread(@Main(),#Null))
[02:17:29] Waiting for executable to start...
[02:17:29] Executable started.
[02:17:44] [ERROR] WebBrowser.pb (Line: 36)
[02:17:44] [ERROR] Invalid memory access. (write error at address 56)
[02:17:47] The Program was killed.