|ZZZ| Queston - Loading URL in VB 5.0 Pro |ZZZ| 
Author Message
 |ZZZ| Queston - Loading URL in VB 5.0 Pro |ZZZ|

Hey guys,
   How can I have it so that a user can click on a button and the
program loads THEIR DEFAULT BROWER (pops it up) with a SPECIFIC URL
(that I have put in the code)?

Thanks,
Peter Pappas

The Programmer's Page
http://www.*-*-*.com/ ~peterp/



Tue, 09 May 2000 03:00:00 GMT  
 |ZZZ| Queston - Loading URL in VB 5.0 Pro |ZZZ|

'In the Declarations part of a Module:
Declare Function FindExecutable Lib "shell32.dll" Alias "FindExecutableA"
(ByVal lpFile As String, ByVal _
lpDirectory As String, ByVal lpResult As String) As Long

Sub OpenURL
        Dim lpResult As string
        Dim lExe as long
        Dim sExe as string
        Dim Dummy as string
        Dim r as long

        Dummy = [any existing .htm-file in your App.Path]
        lpResult = String(128, " ")
        lExe = FindExecutable(Dummy, App.Path, lpResult)
        'This I have made up to get rid of the Null in the null-terminated string:
        sExe = Left(lpResult, InStr(1, lpResult, ".exe", vbTextCompare) + 3)
        r = Shell(sExe & " http://www.railsoft.dk", vbNormalFocus)
End Sub

The function FindExecutable finds the programme associated with .htm-files,
i.e the default browser.
When calling the function, lpResult holds the entire path to the browser.
Then just call VBs Shell with your URL as the commandline argument.

--
Jens Vestergaard
http://www.railsoft.dk
Remove NoSpam to reply



Quote:
> Hey guys,
>    How can I have it so that a user can click on a button and the
> program loads THEIR DEFAULT BROWER (pops it up) with a SPECIFIC URL
> (that I have put in the code)?

> Thanks,
> Peter Pappas

> The Programmer's Page
> http://www.professionals.com/~peterp/



Tue, 09 May 2000 03:00:00 GMT  
 
 [ 2 post ] 

 Relevant Pages 

1. |ZZZ| Queston - Loading URL in VB 5.0 Pro |ZZZ|

2. |ZZZ| Check it out! |ZZZ|

3. |ZZZ| The time is now!!! |ZZZ|

4. |ZZZ| The Programmer's Page |ZZZ|

5. |ZZZ| OCXs |ZZZ|

6. |ZZZ| Source Code |ZZZ|

7. |ZZZ| OCXs |ZZZ|

8. |ZZZ| Source Code |ZZZ|

9. |ZZZ| Quick Question - About were to look for VB answers! |ZZZ

10. |ZZZ| Quick Question - About were to look for VB answers! |ZZZ

11. |ZZZ| The 'New' Programmer's Page |ZZZ|

12. |ZZZ| What!.....You want the best QB Page? |ZZZ|

 

 
Powered by phpBB® Forum Software