• Welcome to Theos PowerBasic Museum 2017.

Question about FF Web-Browse sample program

Started by Marty Francom, December 02, 2009, 11:25:50 PM

Previous topic - Next topic

0 Members and 1 Guest are viewing this topic.

Marty Francom

I have been playing with your WebBrowser example for FireFly.  I have modified it to do unattended auto lookups of certain web sites. Occassionally, I get a "Script Error" messagebox popping up that must be answered before the automation will continue. 

Is there a way to turn off "Script Error" checking?  Or to have the program ignor script errors and just continue?
   

José Roca

 
You have to set the Silent property of the IWebBrowser2 interface to TRUE, e.g. pIWebBrowser2.Silent = %TRUE.

Marty Francom

#2
Thank you.   But I am getting an error message at compile time.
Did I miss understand.  See screen print.

Marty Francom

#3
Decided to compile project directly with PB9 and got a different error.
Undefined Equate.

See screen print:

José Roca

Quote
Error 526: Period not allowed.

You can't compile it with PB 8.x. You need PB 9.x.

Quote
Undefined Equate.

You can't mix the use of my include files with the ones provided with PB. If you compile the program using the PB ide, then make sure that you follow the instructions provided in my headers post:

Quote
Unzip the attached file to a folder of your choice and replace the PB Include path in the PB Ide or the editor that you are using to that folder instead of C:\PBWin90\WinApi.




Marty Francom

#5
Jose'
   Yes, I was compiling with PB version 9.02   If you look closely at the screen print you will see the PB version in the compiler error message.

   And, yes,  I have your includes as being the ones to use.  I set this in FF3 project properties.

   Note: the program will compile if I remove this statement:

        pIWebBrowser2.Silent = %TRUE

I could email the project to you if you think that would help you determine the problem.  Your includes are from WINAPI_114.ZIP  and the newest files are dated 07/15/2009

If you put this statement in your FF3 Web-Browser program and try and compile it you will get the exact same error message.   Give it a try. And let me know what you see.

Any other suggestions?

José Roca

 
I dis say e.g. pIWebBrowser2.Silent = %TRUE. Change pIWebBrowser2 to the name of the object variable you want to use. I see that, in the example, Paul, that wrote that example, uses pWebDispatch, so try pWebDispatch.Silent = %TRUE.


Marty Francom

Sorry, spoke to soon.   Yes, it compiles.   But, the program crashes immediately after starting.  If that statement is removed then the program runs normally.  I put the statement in the Form_Wm_Create function.

Any other suggestions?

José Roca


Marty Francom

#10
Here's the function:


Function FRMMAIN_WM_CREATE ( _
                          hWndForm As Dword, _      ' handle of Form
                          ByVal UserData As Long _  ' optional user defined Long value
                          ) As Long

  Local pWebDispatch As IWebBrowser2
  Local pWebEvents   As DWebBrowserEvents2Impl
  Local vURL         As Variant
 
  ' Get a reference to the web control and set the properties
  pWebDispatch = OC_GetDispatch(HWND_FRMMAIN_OCXCONTROL1)
 
  If IsObject(pWebDispatch) Then
     
     ' Initially display the PlanetSquires site
     vURL = "http://www.planetsquires.com"
     pWebDispatch.Navigate2 vURL
     
     ' Connect to the events fired by the control
     pWebEvents = Class "CDWebBrowserEvents2"
     OC_Advise HWND_FRMMAIN_OCXCONTROL1, pWebEvents  
     
     pWebEvents   = Nothing
     pWebDispatch = Nothing
 
  End If

  pWebDispatch.Silent = %TRUE

End Function



And attached is the complete FF3 project.

José Roca

Move pWebDispatch.Silent = %TRUE before pWebDispatch = Nothing. Otherwise, it will GPF for trying to use a null object.

Marty Francom

Yes, that worked. The program seems to be functioning normally.
Thank you for the help.