Welcome To The Home Of The Visual FoxPro Experts  
home. signup. forum. archives. search. google. articles. downloads. faq. members. weblogs. file info. rss.
 From: Koen Piller
  Where is Koen Piller?
 Santpoort-Zuid
 Netherlands
 Koen Piller
 To: Mike Gagnon
  Where is Mike Gagnon?
 Pointe Claire
 Canada
 Mike Gagnon
 Tags
Subject: RE: save URL
Thread ID: 104571 Message ID: 104715 # Views: 1 # Ratings: 0
Version: Visual FoxPro 9 Category: Win32API programming
Date: Saturday, August 19, 2006 6:12:19 PM         
   


> Can you explain how you are using this variable? Or how you are using internet explorer? Are you within Foxpro? You are probably better using the web browser activex on a form, and store the LocationURL in a property of the form. Or make internet explore a part of your main screen.
>
Public oform1
> oform1=Newobject("form1")
> oform1.Show
> Return
> Define Class form1 As Form
> 	Top = 0
> 	Left = 0
> 	Height = 443
> 	Width = 624
> 	DoCreate = .T.

Mike,

I have a simple address control form,  with address, postalcode etc fields and a cmdGoUrl
the cmdGoURL.click simple coding like
[vfp]
with thisform.PageFrame1.Page3
	lcStart_ZIP = "1012KK"
	lcStart_ADDRESS = "Rokin"
	lcStart_CITY = "Amsterdam"
	lcDestination_ADDRESS = alltrim(.cAddress.value)
	lcDestination_ZIP = alltrim(.cPostalCode.value)
	lcDestination_CITY = alltrim(.cCity.value)
	if !empty(lcDestination_ADDRESS) and !empty(lcDestination_ZIP) and !empty(lcDestination_CITY)
		lGoOn = .t.
	endif

	cUrl = "http://maps.msn.nl/(fod04h45plkqt1452pedqs45)/DirectionsFind.aspx?"+;
		"strt1=" + lcStart_ADDRESS+;
		"&zipc1=" + lcStart_ZIP+;
		"&city1=" + lcStart_CITY+;
		"&strt2=" + lcDestination_ADDRESS+;
		"&zipc2=" + lcDestination_ZIP+;
		"&city2=" + lcDestination_CITY+;
		"&stnm1=" +;
		"&cnty1=12" +;
		"&stnm2=" +;
		"&cnty2=12" +;
		"&src=GM"
	tcUrl=cUrl
	if lGoOn = .t.
		public lcNewURL
		public oBrowser
		oBrowser = createobject("internetexplorer.application")
		oBrowser.navigate(tcUrl)
		oBrowser.visible = .t.
		lcNewURL=oBrowser.LocationURL
	endif
	wait window lcNewURL      &&just for debugging purpose
	
endwith
[/vfp]
as you can see the “starting point is hard coded. So I would like to save the, by the user changed new starting point into a variable, saved to an ini  file and use this further use. 
Any how it does not seem to be possible so I will have to change with a little input form for the default starting point.

Koen
> 	Caption = "Fox Explorer"
> 	TitleBar = 0
> 	WindowState = 2
> 	AlwaysOnBottom = .T.
> 	Name = "Form1"
> 	Add Object obrowser As OleControl With ;
> 		Top = 31, ;
> 		Left = 0, ;
> 		Height = 305, ;
> 		Width = 432, ;
> 		TabIndex = 3, ;
> 		Name = "oBrowser" ,;
> 		OleClass = "Shell.Explorer.2"
> 	Add Object txturl As TextBox With ;
> 		Height = 23, ;
> 		Left = 42, ;
> 		TabIndex = 1, ;
> 		Top = 2, ;
> 		Width = 480, ;
> 		Name = "txtUrl"
> 	Add Object label1 As Label With ;
> 		Caption = "Url:", ;
> 		Height = 17, ;
> 		Left = 12, ;
> 		Top = 6, ;
> 		Width = 27, ;
> 		TabIndex = 4, ;
> 		Name = "Label1"
> 	Add Object btngo As CommandButton With ;
> 		Top = 0, ;
> 		Left = 528, ;
> 		Height = 27, ;
> 		Width = 35, ;
> 		Caption = "\<Go", ;
> 		Default = .T., ;
> 		Name = "btnGo"
> 	Add Object ostatus As OleControl With ;
> 		Top = 424, ;
> 		Left = 0, ;
> 		Height = 19, ;
> 		Width = 624, ;
> 		Align = 2, ;
> 		Name = "oStatus" , ;
> 		OleClass ="MSComctlLib.SBarCtrl.2"
> 	Procedure Navigate
> 	Lparameter lcUrl
> 	Thisform.obrowser.Navigate(Trim(lcUrl))
> 	Endproc
> 	Procedure Hide
> 	This.Visible = .F.
> 	Acti Screen
> 	Endproc
> 	Procedure Resize
> 	Thisform.obrowser.Height = Thisform.Height - Thisform.obrowser.Top
> 	Thisform.obrowser.Width = Thisform.Width
> 	Endproc
> 	Procedure Init
> 	Thisform.obrowser.Navigate("www.google.com")
> 	Thisform.Visible = .T.
> 	Thisform.WindowState  = 2
> 	Thisform.Resize()
> 	Endproc
> 	Procedure obrowser.Refresh
> 	Nodefault
> 	Endproc
> 	Procedure obrowser.StatusTextChange
> 	Lparameters Text
> 	Set Message To Text
> 	Endproc
> 	Procedure obrowser.NavigateComplete2
> 	Lparameters pdisp, url
> 	Thisform.txturl.Value = url
> 	Endproc
> 	Procedure btngo.Click
> 	Thisform.Navigate(Trim(Thisform.txturl.Value))
> 	Endproc
> Enddefine

>
>
>
>
> > > > Thanks - but not to my satisfaction. i. the routing is in English even if I start in Holland and stay in Holland and ii. it does not seem to be as acurate as the MS. I figure I will have to make an other aproach to save the departing point.
> > > > Koen

> > >
> > > I just meant to use the code as an example. The principle is the same, just apply it to your site.
> > >
> > >
> > >
> > > > > From the message 102431, ShellExecute is being used, and don't think it is possible using that method since there is no "hook" to internet explorer. But if you automate Internet explorer instead to can. Use the following example and navigate to another page, and the oBrowser.LocationUrl contains the current url
> > > > >
> > > > >
> > > > > tcUrl="http://www.mapquest.com/"
> > > > > PUBLIC oBrowser
> > > > > oBrowser = CREATEOBJECT("internetexplorer.application")
> > > > > oBrowser.navigate(tcURL)
> > > > > oBrowser.visible = .t.
> > > > >
> > > > > P.S. There is an example (faq184-4666) on Tek-Tips I wrote how to automate Mapquest.
> > > > >
> > > > > > Hi,
> > > > > >
> > > > > > I have implented the MS routeplannner (thanks to Hans de Groot message 102431). Now I would like to save the changed URL the user typed in when e.g. changing the starting point. Any idea how to save the URL in my app after closing the Internet application and returning to the VFP app?
> > > > > > Thanks

> > > > >
> > > > >
> > > > >
> > > > > Mike Gagnon
> > > > >

> > > >
> > > > Mike,
> > > >
> > >
> > >
> > >
> > >
> > > Mike Gagnon
> > >

> > Mike,
> >
> > O.K. misunderstood.
> > Now changed my coding to my webpage, oBrowser.LocationURL starts indeed with the starting URL and I can even see in the debugger it will change if I rederect to an other starting point, however unfortunately this new value cannot be saved in a FoxPro variable for further processing. In the debugger the public variable lcNewUrl = "" and aftre closing down IE .
> > Since I see the oBrowser.LocationURL in the debugger with a new value, I have a strong feeling I am doing something wrong but cannot get my hands on it.
> >
> > Koen

>
>
>
> Mike Gagnon
>


ENTIRE THREAD

save URL Posted by Koen Piller @ 8/17/2006 6:11:00 PM
RE: save URL Posted by Mike Gagnon @ 8/17/2006 7:36:47 PM
RE: save URL Posted by Koen Piller @ 8/17/2006 10:07:25 PM
RE: save URL Posted by Mike Gagnon @ 8/18/2006 12:00:16 PM
RE: save URL Posted by Koen Piller @ 8/18/2006 2:18:11 PM
RE: save URL Posted by Mike Gagnon @ 8/19/2006 12:55:36 PM
RE: save URL Posted by Koen Piller @ 8/19/2006 6:12:19 PM
RE: save URL Posted by Mike Gagnon @ 8/19/2006 6:33:36 PM
RE: save URL Posted by Koen Piller @ 8/20/2006 1:03:13 AM
RE: save URL Posted by Borislav Borissov @ 8/20/2006 7:56:46 AM
RE: save URL Posted by Koen Piller @ 8/20/2006 8:43:32 AM
RE: save URL Posted by Borislav Borissov @ 8/20/2006 12:18:45 PM
RE: save URL Posted by Koen Piller @ 8/20/2006 1:14:42 PM
RE: save URL Posted by Borislav Borissov @ 8/20/2006 2:50:33 PM
RE: save URL Posted by Koen Piller @ 8/20/2006 3:53:04 PM
RE: save URL Posted by Borislav Borissov @ 8/20/2006 5:40:43 PM
RE: save URL Posted by Koen Piller @ 8/20/2006 5:58:09 PM
RE: save URL Posted by Borislav Borissov @ 8/20/2006 6:07:20 PM
RE: save URL Posted by Koen Piller @ 8/20/2006 6:45:10 PM
RE: save URL Posted by Borislav Borissov @ 8/20/2006 6:53:50 PM