FiveTech Support Forums

FiveWin / Harbour / xBase community
Board index FiveWin for Harbour/xHarbour Retrieving a web page via shell.explorer
Posts: 190
Joined: Tue Mar 14, 2006 01:59 AM
Retrieving a web page via shell.explorer
Posted: Tue Sep 02, 2008 02:29 PM
Hello guys,

I'm trying to retrieve the page content without success. Please see the small sample below. I can retrieve many properties without troubles, but the "Document" one or other objects which are always retrieved as "Numbers" instead of "Objects".

Should I use call the "GetProperty" method (http://msdn.microsoft.com/en-us/library/aa768398(VS.85).aspx) to retrieve the document object, or am I missing something obvious ?

Thank you,
Davide

Function Main()
Local oWnd,oActiveX

DEFINE WINDOW oWnd TITLE "Test"

   oActiveX = TActiveX():New( oWnd, "Shell.Explorer" ) 
  
   oWnd:oClient := oActiveX // To fill the entire window surface

   oActiveX:Do( "Navigate2", "http://www.fivetechsoft.com" ) 

   ACTIVATE WINDOW oWnd MAXIMIZED 

   Do While oActiveX:GetProp( "Busy" )  
     SysWait(.5) 
   Enddo

   ? "ok, finished, so far, so good"

   ? "ReadyState",oActiveX:GetProp( "ReadyState" )   // -> 4 ok
   ? "FullName", oActiveX:GetProp( "FullName" )      // -> HB_ARGV(0)
   ? "Type",oActiveX:GetProp( "Type" )               // -> "Documento HTML"
   ? "StatusText",oActiveX:GetProp( "StatusText" )   // -> ""
   ? ValType( oActiveX:GetProp( "Document" ) )       // -> N
   ? ValType (oActiveX:GetProp( "Application" ) )    // -> N
   ? "Parent", ValType(oActiveX:GetProp( "Parent" )) // -> N
Posts: 44158
Joined: Thu Oct 06, 2005 05:47 PM
Retrieving a web page via shell.explorer
Posted: Tue Sep 02, 2008 03:25 PM

Davide,

FWH Class TActiveX has been greatly improved from version 8.07, specially to be able to deal with those kind of objects.

You should try it with the current FWH 8.08

regards, saludos

Antonio Linares
www.fivetechsoft.com
Posts: 190
Joined: Tue Mar 14, 2006 01:59 AM
Retrieving a web page via shell.explorer
Posted: Tue Sep 02, 2008 04:26 PM

Antonio, please look at your mailbox. Thank you

Posts: 44158
Joined: Thu Oct 06, 2005 05:47 PM
Retrieving a web page via shell.explorer
Posted: Tue Sep 02, 2008 06:28 PM

Davide,

Done, thanks

regards, saludos

Antonio Linares
www.fivetechsoft.com
Posts: 44158
Joined: Thu Oct 06, 2005 05:47 PM
Retrieving a web page via shell.explorer
Posted: Tue Sep 02, 2008 06:43 PM

Davide,

Please test this EXE. It uses your source code with some modifications, PRG included:

http://rapidshare.com/files/142118350/davide.zip.html

regards, saludos

Antonio Linares
www.fivetechsoft.com
Posts: 246
Joined: Sat Mar 03, 2007 08:42 PM
Re: Retrieving a web page via shell.explorer
Posted: Wed Sep 03, 2008 06:51 AM
Hello Davide,

I do it like this:
FUNCTION wfReadURL(cUrl)
  LOCAL cPageContent:="Error: " + cUrl + " not found or timed out."
  LOCAL oConn
  
  IF Upper(Left(cUrl,4))#"HTTP"
     cUrl:="http://"+cUrl
  ENDIF
  
  TRY
  
   oConn := TipClientHttp():New(TURL():New(cUrl))
   oConn:nConnTimeout := 20000

   IF oConn:Open(cURL)
      cPageContent := oConn:ReadAll()
      oConn:Close()
   ENDIF
   
  CATCH
   cPageContent:="Error opening " + cUrl
   
  END
  
RETURN cPageContent

No need for IE or any other browser or any ther Objetc. :-)

Patrick
Posts: 190
Joined: Tue Mar 14, 2006 01:59 AM
Retrieving a web page via shell.explorer
Posted: Wed Sep 03, 2008 07:05 AM

Dear Patrick,

I actually do something similar with TWebClient (I think)
Does TipClientHttp() allow posting data to a script ?
Where do I find its documentation ?

Thank you,
Davide

Posts: 246
Joined: Sat Mar 03, 2007 08:42 PM
Retrieving a web page via shell.explorer
Posted: Wed Sep 03, 2008 07:19 AM
Davide wrote:I actually do something similar with TWebClient (I think)
Does TipClientHttp() allow posting data to a script ?
Where do I find its documentation ?
Look for a messages with subject "xHarbour and 'SUBMIT'ing Web pages" on the comp.lang.xharbour news group. There are samples on how to do it.

Patrick
Posts: 44158
Joined: Thu Oct 06, 2005 05:47 PM
Retrieving a web page via shell.explorer
Posted: Wed Sep 03, 2008 08:53 AM

Patrick,

Davide's way, using an activex, opens incredible possibilities... :-)

Really incredible...

I am testing it right now and I am shocked :-)

regards, saludos

Antonio Linares
www.fivetechsoft.com
Posts: 246
Joined: Sat Mar 03, 2007 08:42 PM
Retrieving a web page via shell.explorer
Posted: Wed Sep 03, 2008 08:56 AM
Antonio Linares wrote:Davide's way, using an activex, opens incredible possibilities... :-)
Really incredible...
Please convince me! :-)

Patrick
Posts: 44158
Joined: Thu Oct 06, 2005 05:47 PM
Retrieving a web page via shell.explorer
Posted: Wed Sep 03, 2008 08:59 AM

Patrick,

I am shocked right now... :-)

Using Davide's way you get all the power of Microsoft's Internet Explorer engine at your service.

I am building a demo right now and Wow...

regards, saludos

Antonio Linares
www.fivetechsoft.com
Posts: 44158
Joined: Thu Oct 06, 2005 05:47 PM
Retrieving a web page via shell.explorer
Posted: Wed Sep 03, 2008 10:04 AM

Feel the power of the Microsoft's Internet Explorer engine managed from your FWH application :-)

And this is just a beginning...

http://rapidshare.com/files/142265138/webscan.zip.html

regards, saludos

Antonio Linares
www.fivetechsoft.com
Posts: 246
Joined: Sat Mar 03, 2007 08:42 PM
Retrieving a web page via shell.explorer
Posted: Wed Sep 03, 2008 11:11 AM
Antonio Linares wrote:Feel the power of the Microsoft's Internet Explorer engine managed from your FWH application :-)
And this is just a beginning...
http://rapidshare.com/files/142265138/webscan.zip.html

Haha, great!! :-)

Patrick
Posts: 190
Joined: Tue Mar 14, 2006 01:59 AM
Retrieving a web page via shell.explorer
Posted: Wed Sep 03, 2008 12:40 PM

Antonio: Some of the properties I sent you this morning allows even to be changed directly inside the ActiveX control. This way you could even change the appearance of your page locally, allowing you to use your web server as a "template" for your local application (now it's time to be really excited :wink: ).

Patrick: I've read the thread you forwarded me. I found posts related to how to post data via OLE and Explorer (like what I was trying to do via ActiveX), but not via TUrl(). Did I miss something ?

Thanks,
Davide

Posts: 246
Joined: Sat Mar 03, 2007 08:42 PM
Retrieving a web page via shell.explorer
Posted: Wed Sep 03, 2008 12:43 PM
Davide wrote:Patrick: I've read the thread you forwarded me. I found posts related to how to post data via OLE and Explorer (like what I was trying to do via ActiveX), but not via TUrl(). Did I miss something ?
No, that was what I wanted to show you. I have no sample or that with TUrl.

Patrick