Navigate question

General Help regarding HMG, Compilation, Linking, Samples

Moderator: Rathinagiri

Post Reply
User avatar
serge_girard
Posts: 3165
Joined: Sun Nov 25, 2012 2:44 pm
DBs Used: 1 MySQL - MariaDB
2 DBF
Location: Belgium
Contact:

Navigate question

Post by serge_girard »

Hello all !

Probably my last question this year....

How can I get the url address in my textbox when I leave a page.
I start (for example) in http://www.hmgforum.com and then click on 'active posts' it gives something like http://hmgforum.com/search.php?search_i ... 98e616821..

How can I retrieve this location in my program?

Thanks to all and a happy newyear !

Serge

Code: Select all

#INCLUDe "hmg.ch"

cAddress		:= 'http://www.hmgforum.com' 

DEFINE WINDOW mainx ;
	AT 0,0 ;
	WIDTH  1300 ;
	HEIGHT 900 ;
	TITLE 'TEST  '  ;
   MAIN

	@ 10,10 TEXTBOX T_cAddress ;
      WIDTH		 400 ;
      VALUE     cAddress  

	@ 50,10 ACTIVEX Test ;
		WIDTH  1250  ;
		HEIGHT 800  ;
		PROGID "shell.explorer.2"  

END WINDOW

mainx.Test.Object:Navigate(cAddress)

CENTER WINDOW mainx
ACTIVATE WINDOW mainx

RETURN
There's nothing you can do that can't be done...
User avatar
Pablo César
Posts: 4059
Joined: Wed Sep 08, 2010 1:18 pm
Location: Curitiba - Brasil

Navigate question

Post by Pablo César »

Hi Serge,

I re-edited your post because it was too confusing. You had not used the URL tags in your message. I hope you do not get mad at me because of my re-editing. ;)

Your case seems possible but I think we have no any function to do this at ActiveX.prg.

I think first step is to get the handle window of your browser. Remeber you can have many session opened. Then using a C function to get it.

Here is a VC example:

http://www.codeproject.com/Questions/52 ... -is-curren

Here some more:

http://msdn.microsoft.com/en-us/library ... -snippet-1
http://www.codeproject.com/Questions/65 ... om-browser

You'm sorry, I did not have something ready to give to you. :oops:
HMGing a better world
"Matter tells space how to curve, space tells matter how to move."
Albert Einstein
User avatar
srvet_claudio
Posts: 2193
Joined: Thu Feb 25, 2010 8:43 pm
Location: Uruguay
Contact:

Re: Navigate question

Post by srvet_claudio »

Hi Serge,
this is a simplification of a program I use to know weather forecasts long term, this helps me make decisions about grazing livestock feed. I hope this demo is useful to you.

Code: Select all

#include "hmg.ch"

FUNCTION Main()

   DEFINE WINDOW Win1 ;
      AT 0,0 ;
      WIDTH 800 ;
      HEIGHT 600 ;
      TITLE "Weather Forecasts";
      MAIN;
      ON PAINT (    Win1.Test.Width   := Win1.Width - 28,;
                    Win1.Test.Height  := Win1.Height- 95 )

      DEFINE MAIN MENU
         POPUP "CPTEC"         
            MENUITEM "Go.." ACTION Win1.Test.Object:Navigate("http://clima1.cptec.inpe.br/gpc/")
         END POPUP
         
         POPUP "IRI"
            MENUITEM "Go ..." ACTION Win1.Test.Object:Navigate("http://iri.columbia.edu/our-expertise/climate/forecasts/seasonal-climate-forecasts/")
         END POPUP
      END MENU

      DEFINE LABEL LABEL_1
         ROW 0
         COL 10
         WIDTH 80
         HEIGHT 24
         VALUE "Http:"
      END LABEL
      
      DEFINE TEXTBOX TEXT_1
         ROW 0
         COL 100
         WIDTH 500
         HEIGHT 24
         VALUE ""
      END TEXTBOX
      
 
      DEFINE BUTTON BTN_1
         ROW 0
         COL 610
         WIDTH 24
         HEIGHT 24
         CAPTION "Go"
         ACTION Win1.Test.Object:Navigate( Win1.Text_1.Value )
      END BUTTON

      
      DEFINE BUTTON BTN_2
         ROW 0
         COL 650
         WIDTH 60
         HEIGHT 24
         CAPTION "Get URL"
         ACTION Win1.Text_1.Value := Win1.Test.Object:LocationURL() 

         //   Win1.Test.Object:Visible = .T.
         //   Win1.Test.Object:AddressBar := .T.
         //   Win1.Test.Object:GoHome ()
         //   Win1.Test.Object:Busy()
         //   Win1.Test.Object:GoSearch()
         //   Win1.Text_1.Value := Win1.Test.Object:LocationURL()
         //  * Win1.Test.Object:GoBack ()
         //  * Win1.Test.Object:GoForward ()
      END BUTTON

      
      
      DEFINE ACTIVEX Test
         ROW       30
         COL       10
         WIDTH     100  
         HEIGHT    100
         PROGID    "shell.explorer.2"
      END ACTIVEX

      Win1.Test.Object:Navigate("about:blank")
      
   END WINDOW

   Center Window Win1

   Activate Window Win1

RETURN NIL
Best regards.
Dr. Claudio Soto
(from Uruguay)
http://srvet.blogspot.com
User avatar
serge_girard
Posts: 3165
Joined: Sun Nov 25, 2012 2:44 pm
DBs Used: 1 MySQL - MariaDB
2 DBF
Location: Belgium
Contact:

Re: Navigate question

Post by serge_girard »

Thanks Pablo & Claudio!

I will take look right away!

Serge
There's nothing you can do that can't be done...
User avatar
serge_girard
Posts: 3165
Joined: Sun Nov 25, 2012 2:44 pm
DBs Used: 1 MySQL - MariaDB
2 DBF
Location: Belgium
Contact:

Re: Navigate question

Post by serge_girard »

Claudio,

This is working nice ! Pity that ACTIVEX don't accept ON CHANGE..

Thx !

Serge
There's nothing you can do that can't be done...
User avatar
srvet_claudio
Posts: 2193
Joined: Thu Feb 25, 2010 8:43 pm
Location: Uruguay
Contact:

Re: Navigate question

Post by srvet_claudio »

serge_girard wrote:Pity that ACTIVEX don't accept ON CHANGE.
Yes is pity.
Best regards.
Dr. Claudio Soto
(from Uruguay)
http://srvet.blogspot.com
User avatar
serge_girard
Posts: 3165
Joined: Sun Nov 25, 2012 2:44 pm
DBs Used: 1 MySQL - MariaDB
2 DBF
Location: Belgium
Contact:

Re: Navigate question

Post by serge_girard »

One solution is to put a TIMER function but that is .... bad and ugly programming...?

Thx anyway, Claudio !

Serge
There's nothing you can do that can't be done...
User avatar
Pablo César
Posts: 4059
Joined: Wed Sep 08, 2010 1:18 pm
Location: Curitiba - Brasil

Navigate question

Post by Pablo César »

Claudio, thank you to share and almost goes unnoticed your usage of Object.
 
srvet_claudio wrote: Tue Dec 31, 2013 1:31 am
Screen99.png
Screen99.png (10.06 KiB) Viewed 3256 times
 
What it would be: a pre-set object or a variable name of the object type ?

Where this Object is defined ? How it know it that's a object ?

Very clever indeed ! :P
HMGing a better world
"Matter tells space how to curve, space tells matter how to move."
Albert Einstein
Post Reply