Retrieving a web page via shell.explorer

Davide
Posts: 190
Joined: Tue Mar 14, 2006 1:59 am
Location: Italy

Retrieving a web page via shell.explorer

Post 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 ... S.85).aspx) to retrieve the document object, or am I missing something obvious ?

Thank you,
Davide

Code: Select all

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
User avatar
Antonio Linares
Site Admin
Posts: 37481
Joined: Thu Oct 06, 2005 5:47 pm
Location: Spain
Contact:

Post 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
regards, saludos

Antonio Linares
www.fivetechsoft.com
Davide
Posts: 190
Joined: Tue Mar 14, 2006 1:59 am
Location: Italy

Post by Davide »

Antonio, please look at your mailbox. Thank you
User avatar
Antonio Linares
Site Admin
Posts: 37481
Joined: Thu Oct 06, 2005 5:47 pm
Location: Spain
Contact:

Post by Antonio Linares »

Davide,

Done, thanks
regards, saludos

Antonio Linares
www.fivetechsoft.com
User avatar
Antonio Linares
Site Admin
Posts: 37481
Joined: Thu Oct 06, 2005 5:47 pm
Location: Spain
Contact:

Post 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
regards, saludos

Antonio Linares
www.fivetechsoft.com
User avatar
Patrick Mast
Posts: 244
Joined: Sat Mar 03, 2007 8:42 pm

Re: Retrieving a web page via shell.explorer

Post by Patrick Mast »

Hello Davide,

I do it like this:

Code: Select all

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
Davide
Posts: 190
Joined: Tue Mar 14, 2006 1:59 am
Location: Italy

Post 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
User avatar
Patrick Mast
Posts: 244
Joined: Sat Mar 03, 2007 8:42 pm

Post 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
User avatar
Antonio Linares
Site Admin
Posts: 37481
Joined: Thu Oct 06, 2005 5:47 pm
Location: Spain
Contact:

Post 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 :-)
Last edited by Antonio Linares on Wed Sep 03, 2008 8:57 am, edited 1 time in total.
regards, saludos

Antonio Linares
www.fivetechsoft.com
User avatar
Patrick Mast
Posts: 244
Joined: Sat Mar 03, 2007 8:42 pm

Post by Patrick Mast »

Antonio Linares wrote:Davide's way, using an activex, opens incredible possibilities... :-)
Really incredible...
Please convince me! ;-)

Patrick
User avatar
Antonio Linares
Site Admin
Posts: 37481
Joined: Thu Oct 06, 2005 5:47 pm
Location: Spain
Contact:

Post 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...
regards, saludos

Antonio Linares
www.fivetechsoft.com
User avatar
Antonio Linares
Site Admin
Posts: 37481
Joined: Thu Oct 06, 2005 5:47 pm
Location: Spain
Contact:

Post 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
regards, saludos

Antonio Linares
www.fivetechsoft.com
User avatar
Patrick Mast
Posts: 244
Joined: Sat Mar 03, 2007 8:42 pm

Post 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
Davide
Posts: 190
Joined: Tue Mar 14, 2006 1:59 am
Location: Italy

Post 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
User avatar
Patrick Mast
Posts: 244
Joined: Sat Mar 03, 2007 8:42 pm

Post 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
Post Reply