Caggs
asked on
Internet shortcuts in application
i was hoping some of you experts could help me with a little problem. i would like to have shortcuts to various sites in my application and i don't really know how to go about it. i would like the user to be able to click particular buttons which will launch their default browser and automatically load up pre-defined url's.
can any of you guys help me? if so it would be greatly appreciated.
thanx for your time.
can any of you guys help me? if so it would be greatly appreciated.
thanx for your time.
ASKER
thanx for your response tgl
i entered the code u gave me and ran my program, but when i clicked the image that i attached the code to, it came up with a message "compile error - sub or function not defined"
when i clicked ok, the code was presented to me with the word FindExecutable highlighted in the line
"RetVal = FindExecutable(filename, Dummy, BrowserExec)"
with my limited vb knowledge i don't know what to do?
think you cuold help me out again?
i entered the code u gave me and ran my program, but when i clicked the image that i attached the code to, it came up with a message "compile error - sub or function not defined"
when i clicked ok, the code was presented to me with the word FindExecutable highlighted in the line
"RetVal = FindExecutable(filename, Dummy, BrowserExec)"
with my limited vb knowledge i don't know what to do?
think you cuold help me out again?
I think FindExecutable is an API.
ASKER
thanx for the comment kdivad
i read up on api's and declared the FindExecutable and ShellExecute api's in my project (which is just a standard exe project) and now when i run the program and click the image which i want to link to a site, i no longer get the compile error messages, however it doesn't launch the browser for some reason. it accepts the click, displays the little arrow with the hourglass(indicating it is processing), sends communication to the web (saw modem activity in tray icon) but does not launch the default browser and display the site...
any ideas on why this is?
i read up on api's and declared the FindExecutable and ShellExecute api's in my project (which is just a standard exe project) and now when i run the program and click the image which i want to link to a site, i no longer get the compile error messages, however it doesn't launch the browser for some reason. it accepts the click, displays the little arrow with the hourglass(indicating it is processing), sends communication to the web (saw modem activity in tray icon) but does not launch the default browser and display the site...
any ideas on why this is?
ASKER
Adjusted points to 75
ASKER
thx for the response tgl...
sorry but i have to reject the answer because i couldn't get the code to work. when i click the image i want to link to a site, it accepts the click, displays the little arrow with the hourglass(indicating it is processing), sends communication to the web (saw modem activity in tray icon) but does not launch the default browser and display the site... i left a comment explaining this, hoping u might know why, but it has been two days now without response so i feel i should let some other experts have a go...
if u have any idea why the code didn't work please e-mail me at caggs@morgan.net.au
thanx again anyway.....your input was appreciated
sorry but i have to reject the answer because i couldn't get the code to work. when i click the image i want to link to a site, it accepts the click, displays the little arrow with the hourglass(indicating it is processing), sends communication to the web (saw modem activity in tray icon) but does not launch the default browser and display the site... i left a comment explaining this, hoping u might know why, but it has been two days now without response so i feel i should let some other experts have a go...
if u have any idea why the code didn't work please e-mail me at caggs@morgan.net.au
thanx again anyway.....your input was appreciated
ASKER CERTIFIED SOLUTION
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
ASKER
thanx very much for the help razorzej...
i tested the code and it worked perfectly...however i have found an even easier way to link to sites from another bulletin board....use the following code....
Shell "start URL", vbHide
You may replace 'URL' with your actual internet address you wish to link to. 'vbHide' causes VB not to display an MS-DOS window when executing Start.Exe.
this statement requires no special declarations either...
however, thanx again for the help.....much appreciated
i tested the code and it worked perfectly...however i have found an even easier way to link to sites from another bulletin board....use the following code....
Shell "start URL", vbHide
You may replace 'URL' with your actual internet address you wish to link to. 'vbHide' causes VB not to display an MS-DOS window when executing Start.Exe.
this statement requires no special declarations either...
however, thanx again for the help.....much appreciated
Private Sub Command1_Click()
Dim filename, Dummy As String
Dim BrowserExec As String * 255
Dim RetVal As Long
Dim FileNumber As Integer
' First, create a known, temporary HTML file BrowserExec = Space(255)
filename = "C:\temphtm.HTM"
FileNumber = FreeFile ' Get unused file number
Open filename For Output As #FileNumber ' Create temp HTML file
Write #FileNumber, "<HTML> <\HTML>" ' Output text
Close #FileNumber ' Close file
' Then find the application associated with it
RetVal = FindExecutable(filename, Dummy, BrowserExec)
BrowserExec = Trim(BrowserExec)
' If an application is found, launch it!
If RetVal <= 32 Or IsEmpty(BrowserExec) Then ' Error
MsgBox "Could not find associated Browser", vbExclamation, "Browser Not Found"
Else
RetVal = ShellExecute(Me.hwnd, "open", BrowserExec, _
"put your web page here (like: http://www.site.com)", Dummy, SW_SHOWNORMAL)
If RetVal <= 32 Then ' Error
MsgBox "Web Page not Opened", vbExclamation, "URL Failed"
End If
End If
Kill filename ' delete temp HTML file
End Sub