|
-
May 24th, 2001, 03:07 PM
#1
url in form
How can I add an url like www.microsoft.com into my form, and make the browser start when the user press mouse-button on the url (like a url on the web...)
thanks...
-
May 24th, 2001, 08:01 PM
#2
Re: url in form
private Sub Label1_Click()
Shell "C:\Program Files\Internet Explorer\IEXPLORE.EXE http://www.microsoft.com", vbMaximizedFocus
End Sub
In Label1.Caption print http://www.microsoft.com
Andy Tower
-
May 24th, 2001, 08:21 PM
#3
Re: url in form
You use a label as Tower suggested with the caption set to the URL you want to launch. Then use the following code.
private Declare Function ShellExecute Lib "shell32.dll" Alias _
"ShellExecuteA" (byval hwnd as Long, byval lpOperation as string, _
byval lpFile as string, byval lpParameters as string, byval lpDirectory _
as string, byval nShowCmd as Long) as Long
private Const SW_SHOW = 5
private Sub Label1_Click()
ShellExecute frmMailTo.hwnd, "open", label1.caption, vbNullString, vbNullString, SW_SHOW
Unload me
End Sub
This will launch the default browser, and you don't need to know the full path of the browser executable.
Optionally, you can set the label's MousePointer property to the Hand icon.
If you want to give a hyperlink like effect, you can set the forecolor of the label to blue. In Label_MouseMove, set the forecolor to red. In the MouseMove event of the Form, reset the label's forecolor back to blue.
Posting Permissions
- You may not post new threads
- You may not post replies
- You may not post attachments
- You may not edit your posts
-
Forum Rules
|
Click Here to Expand Forum to Full Width
|