Why circle 2 times after error ???

Just starting out? Need help? Post your questions and find answers here.
Rascal
User
User
Posts: 30
Joined: Mon Sep 17, 2007 11:06 pm

Why circle 2 times after error ???

Post by Rascal »

Code: Select all


Enumeration
  #Web_0
  #Panel_0
  #Window_0
EndEnumeration



Declare   Main()
Declare   WebBrowser_(INT.l)
Declare.l WebBrowser_Scroll(Gadget.l,X.l,Y.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_Scroll(Gadget.l,X.l,Y.l)
CoInitialize_(#Null)
Res.l                         = #False
IWebBrowser2.IWebBrowser2     = GetWindowLong_(GadgetID(Gadget),#GWL_USERDATA)
IDispatch.IDispatch           = #Null
IHTMLDocument3.IHTMLDocument3 = #Null
IHTMLElement.IHTMLElement     = #Null
IHTMLElement2.IHTMLElement2   = #Null
If IWebBrowser2
 If IWebBrowser2\get_Document(@IDispatch) = #S_OK And IDispatch
  If IDispatch\QueryInterface(?IID_IHTMLDocument3,@IHTMLDocument3) = #S_OK And IHTMLDocument3 
   If IHTMLDocument3\get_documentElement(@IHTMLElement) = #S_OK And IHTMLElement 
    If IHTMLElement\QueryInterface(?IID_IHTMLElement2,@IHTMLElement2) = #S_OK And IHTMLElement2
     If IHTMLElement2\put_scrollTop(Y) = #S_OK And IHTMLElement2\put_scrollLeft(X) = #S_OK
         Res = #True 
     EndIf
     IHTMLElement2\Release() 
    EndIf 
    IHTMLElement\Release() 
   EndIf 
   IHTMLDocument3\Release() 
  EndIf 
  IHTMLDocument3\Release() 
 EndIf
 ;IWebBrowser2\Release()
EndIf
CoUninitialize_()
ProcedureReturn Res
EndProcedure

DataSection 
  IID_IWebBrowser2: 
    Data.l $D30C1661 
    Data.w $CDAF, $11D0 
    Data.b $8A, $3E, $00, $C0, $4F, $C9, $E2, $6E 
  IID_IConnectionPointContainer: 
    Data.l $B196B284 
    Data.w $BAB4, $101A 
    Data.b $B6, $9C, $00, $AA, $00, $34, $1D, $07    
  IID_IDispatch: 
    Data.l $00020400 
    Data.w $0000, $0000 
    Data.b $C0, $00, $00, $00, $00, $00, $00, $46 
  IID_IUnknown: 
    Data.l $00000000 
    Data.w $0000, $0000 
    Data.b $C0, $00, $00, $00, $00, $00, $00, $46 
  IID_DWebBrowserEvents2: 
    Data.l $34A715A0 
    Data.w $6587, $11D0 
    Data.b $92, $4A, $00, $20, $AF, $C7, $AC, $4D 
  IID_IHTMLDocument2:
    Data.l $332C4425 
    Data.w $26CB, $11D0 
    Data.b $B4, $83, $00, $C0, $4F, $D9, $01, $19
  IID_IHTMLElement2:
    Data.l $3050F434 
    Data.w $98B5, $11CF 
    Data.b $BB, $82, $00, $AA, $00, $BD, $CE, $0B
  IID_IHTMLDocument3:
    Data.l $3050F485 
    Data.w $98B5, $11CF 
    Data.b $BB, $82, $00, $AA, $00, $BD, $CE, $0B 
  IID_IHTMLElement:
    Data.l $3050F1FF 
    Data.w $98B5, $11CF 
    Data.b $BB, $82, $00, $AA, $00, $BD, $CE, $0B
EndDataSection






;-
Procedure Main()
While #True
Url.s = "http://www.purebasic.com"
Thread.l = CreateThread(@WebBrowser_(),@Url)
Sleep_(1000*20)

Debug WebBrowser_Scroll(#Web_0,20,20)
Sleep_(1000*10)

KillThread(Thread)
Wend 
EndProcedure

WaitThread(CreateThread(@Main(),#Null))

Why circle 2 times after error ???
freak
PureBasic Team
PureBasic Team
Posts: 5946
Joined: Fri Apr 25, 2003 5:21 pm
Location: Germany

Post by freak »

Why create two topics for the same question ?

http://www.purebasic.fr/english/viewtopic.php?p=255064
quidquid Latine dictum sit altum videtur
Rascal
User
User
Posts: 30
Joined: Mon Sep 17, 2007 11:06 pm

Post by Rascal »

now this is the emergence of new problems.
Post Reply