Page 1 of 4

Retrieving a web page via shell.explorer

PostPosted: Tue Sep 02, 2008 2:29 pm
by Davide
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

Code: Select all  Expand view
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

PostPosted: Tue Sep 02, 2008 3:25 pm
by Antonio Linares
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

PostPosted: Tue Sep 02, 2008 4:26 pm
by Davide
Antonio, please look at your mailbox. Thank you

PostPosted: Tue Sep 02, 2008 6:28 pm
by Antonio Linares
Davide,

Done, thanks

PostPosted: Tue Sep 02, 2008 6:43 pm
by Antonio Linares
Davide,

Please test this EXE. It uses your source code with some modifications, PRG included:
http://rapidshare.com/files/142118350/davide.zip.html

Re: Retrieving a web page via shell.explorer

PostPosted: Wed Sep 03, 2008 6:51 am
by Patrick Mast
Hello Davide,

I do it like this:
Code: Select all  Expand view
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

PostPosted: Wed Sep 03, 2008 7:05 am
by Davide
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

PostPosted: Wed Sep 03, 2008 7:19 am
by Patrick Mast
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

PostPosted: Wed Sep 03, 2008 8:53 am
by Antonio Linares
Patrick,

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

Really incredible...

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

PostPosted: Wed Sep 03, 2008 8:56 am
by Patrick Mast
Antonio Linares wrote:Davide's way, using an activex, opens incredible possibilities... :-)
Really incredible...
Please convince me! ;-)

Patrick

PostPosted: Wed Sep 03, 2008 8:59 am
by Antonio Linares
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...

PostPosted: Wed Sep 03, 2008 10:04 am
by Antonio Linares
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

PostPosted: Wed Sep 03, 2008 11:11 am
by Patrick Mast
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

PostPosted: Wed Sep 03, 2008 12:40 pm
by Davide
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

PostPosted: Wed Sep 03, 2008 12:43 pm
by Patrick Mast
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