Retrieving a web page via shell.explorer

Retrieving a web page via shell.explorer

Postby Davide » Tue Sep 02, 2008 2: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

Code: Select all  Expand view  RUN
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
Davide
 
Posts: 190
Joined: Tue Mar 14, 2006 1:59 am
Location: Italy

Postby Antonio Linares » Tue Sep 02, 2008 3: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
User avatar
Antonio Linares
Site Admin
 
Posts: 42100
Joined: Thu Oct 06, 2005 5:47 pm
Location: Spain

Postby Davide » Tue Sep 02, 2008 4:26 pm

Antonio, please look at your mailbox. Thank you
Davide
 
Posts: 190
Joined: Tue Mar 14, 2006 1:59 am
Location: Italy

Postby Antonio Linares » Tue Sep 02, 2008 6:28 pm

Davide,

Done, thanks
regards, saludos

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

Postby Antonio Linares » Tue Sep 02, 2008 6: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
User avatar
Antonio Linares
Site Admin
 
Posts: 42100
Joined: Thu Oct 06, 2005 5:47 pm
Location: Spain

Re: Retrieving a web page via shell.explorer

Postby Patrick Mast » Wed Sep 03, 2008 6:51 am

Hello Davide,

I do it like this:
Code: Select all  Expand view  RUN
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
User avatar
Patrick Mast
 
Posts: 246
Joined: Sat Mar 03, 2007 8:42 pm

Postby Davide » Wed Sep 03, 2008 7: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
Davide
 
Posts: 190
Joined: Tue Mar 14, 2006 1:59 am
Location: Italy

Postby Patrick Mast » Wed Sep 03, 2008 7: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
User avatar
Patrick Mast
 
Posts: 246
Joined: Sat Mar 03, 2007 8:42 pm

Postby Antonio Linares » Wed Sep 03, 2008 8:53 am

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

Postby Patrick Mast » Wed Sep 03, 2008 8:56 am

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

Patrick
User avatar
Patrick Mast
 
Posts: 246
Joined: Sat Mar 03, 2007 8:42 pm

Postby Antonio Linares » Wed Sep 03, 2008 8: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
User avatar
Antonio Linares
Site Admin
 
Posts: 42100
Joined: Thu Oct 06, 2005 5:47 pm
Location: Spain

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

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

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

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

Next

Return to FiveWin for Harbour/xHarbour

Who is online

Users browsing this forum: Google [Bot] and 51 guests