Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations bkrike on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Trouble with hyperlink function "NavigateTo()"

Status
Not open for further replies.

wilfranz

Technical User
Oct 4, 2003
122
US
Hello friends,

The following code to establish a hyperlink is acting strangely.

IF MESSAGEB("Get New Prices... ?", 36) = 6 && If YES...
loHyperlink = CREATEOBJECT("Hyperlink")
loHyperlink.navigateto("ENDIF
RETURN

The above establishes the link then very briefly opens the web window, them immediately minimizes it and returns to the next line of code (in this case RETURN); but it retains the open link minimized.

However if I add a delay...

IF MESSAGEB("Get New Prices... ?", 36) = 6 && If YES...
loHyperlink = CREATEOBJECT("Hyperlink")
loHyperlink.navigateto(" WAIT WINDOW "Connecting..." TIMEOUT 15
ENDIF

... then the web page is opened and loaded normally, and is usable until exited by the user; then returns to the next code line after the IF clause.


I have used this NavigateTo function often in the past without this happening. Any ideas?

Thanks
Wilfranz
 
wilfranz,

The hyperlink will not wait until the browser window is closed before executing the next lines of code. Even on your second example if you wait 15+ seconds you will see that the next line of code is executed after the endif...it is just the Wait Window command that is stopping execution momentarily. The reason for this is fairly straight forward...the browser (no matter which one you are using) is a seperate process and though it is started from your VFP application, your VFP application does not have any control over it.

I did test both of your snippets of code with a variety of browsers and the result is as expected. Open browser, navigate to page, continue with code execution.

boyd.gif

craig1442@mchsi.com
"Whom computers would destroy, they must first drive mad." - Anon​
 
May be navigateto is not suitable for this.

I am just writing off my head. But can be used. The approach should be..

lcLink = "www. ????whatever address"
oHttp.Open("GET", lcLink, .f.)
oHttp.Send
lcText1 = oHttp.ResponseText

The .f. should help for the desired wait as needed.

:)

____________________________________________
ramani - (Subramanian.G) :)
 
Thanks very much Craig and Ramani.

Craig: I understand your good explanation. And looking back at my previous uses of the NavigateTo (which worked just fine), I see that I never had any code instructions following opening the web page. But now that I added code immediately after the NavigateTo, I get this problem. So how do I do this? Ramani suggested an answer... but...

Ramani: This may be what I need, but I don't recognize the oHttp object in your suggestion. Is this an ActiveX or API function command?

TIA

Bill
 
Try adding a SLEEP api call

Code:
DECLARE Sleep IN Win32API INTEGER nMilliseconds
nSleepSeconds = 5
nMilliseconds = nSleepSeconds * 1000
loHyperlink = CREATEOBJECT("Hyperlink")
loHyperlink.navigateto("[URL unfurl="true"]http://www.tiaa-cref.org/charts/ra-performance.htm...")[/URL]
=Sleep(nMilliSeconds)
[COLOR=green]&& Continue here.[/color]

Mike Gagnon

If you want to get the best response to a question, please check out FAQ184-2483 first.
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top