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 strongm on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Hyperlink 3

Status
Not open for further replies.

asm338s

Programmer
Jul 16, 2001
135
US
How can I redirect a user to a website when they click on one of the items in a Drop-down menu.
 
Hi my friend
The HyperLink is a standard control in VFP, you will find it in the control box just like the Grid or command button.
So, all you need to do is..
In your Valid event of this menu item or wherever you see fit, add this code
Code:
Local loHyperLink
loHyperLink=CREATEOBJECT("hyperlink")
loHyperLink.NavigateTo('[URL unfurl="true"]www.Microsoft.com')[/URL]
loHyperLink = Null

Here you go, say hi to Bill Gates.

Note: if you need to read more about the subject, play with the class _HyperLink.VCX in the FFC directory. Walid Magd
Engwam@Hotmail.com
 
The hyperlink object will only work with internet explorer.
If you want to start your default browser (which could be Netscape or Opera or any other browser).

Try this procedure, it uses the default windows way of opening files or URL's (just like when you click on a file).


PROCEDURE NavigateWeb
LPARAMETERS lcWebAddress
LOCAL lhWhnd, lnResult, lcLink

lcLink = IIF(VARTYPE(lcWebAddress) == 'C', lcWebAddress, SPACE(0))

DECLARE INTEGER ShellExecute IN SHELL32 INTEGER hwnd, STRING cOP, STRING cFile,;
STRING cParams, STRING cStartDir, INTEGER nShowCmd

DECLARE INTEGER GetDesktopWindow IN User32

Action=View&ID={DB39ACA2-6330-431D-AAB1-7A45EF6AC520}"
lnWhnd = GetDesktopWindow()
lnResult = ShellExecute(lnWhnd, 'OPEN', lcLink, '', '', 5)

ENDPROC

HTH,
Weedz (Edward W.F. Veld)
My private project:Download the CrownBase source code !!
 
Sorry, slight typing error, the procedure should be:

PROCEDURE NavigateWeb
LPARAMETERS lcWebAddress
LOCAL lhWhnd, lnResult, lcLink

lcLink = IIF(VARTYPE(lcWebAddress) == 'C', lcWebAddress, SPACE(0))

DECLARE INTEGER ShellExecute IN SHELL32 INTEGER hwnd, STRING cOP, STRING cFile,;
STRING cParams, STRING cStartDir, INTEGER nShowCmd

DECLARE INTEGER GetDesktopWindow IN User32

lnWhnd = GetDesktopWindow()
lnResult = ShellExecute(lnWhnd, 'OPEN', lcLink, '', '', 5)

ENDPROC

HTH,
Weedz (Edward W.F. Veld)
My private project:Download the CrownBase source code !!
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top