Aage Eilertsen
May 24th, 2001, 03:07 PM
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...
thanks...
|
Click to See Complete Forum and Search --> : url in form Aage Eilertsen May 24th, 2001, 03:07 PM 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... Tower May 24th, 2001, 08:01 PM 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 shree May 24th, 2001, 08:21 PM 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. codeguru.com
Copyright Internet.com Inc., All Rights Reserved. |