link to the web (call browser) 
Author Message
 link to the web (call browser)

Hello!

Is there a possibility to create an web-link within an vb-programm?

(In the way winword or outlook..... do)

Thanks!

Andi Goering

Sent via Deja.com http://www.*-*-*.com/
Before you buy.



Wed, 18 Jun 1902 08:00:00 GMT  
 link to the web (call browser)

Quote:

> Hello!

> Is there a possibility to create an web-link within an vb-programm?

> (In the way winword or outlook..... do)

> Thanks!

> Andi Goering

Try This

Private Const SW_SHOW = 5       ' Displays Window in its current size and
position
Private Const SW_SHOWNORMAL = 1 ' Restores Window if Minimized or Maximized

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 Declare Function FindExecutable Lib "shell32.dll" Alias _
   "FindExecutableA" (ByVal lpFile As String, ByVal lpDirectory As _
   String, ByVal lpResult As String) As Long

Public Sub LaunchWebSupport(sURL As String)
    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(0, "open", BrowserExec, _
          sURL, 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



Wed, 18 Jun 1902 08:00:00 GMT  
 link to the web (call browser)
This didn't show up on on my news server.  Apologies if you get it twice.

Quote:

> Hello!
> Is there a possibility to create an web-link within an vb-programm?
> (In the way winword or outlook..... do).

Try This

Private Const SW_SHOW = 5       ' Displays Window in its current size and
position
Private Const SW_SHOWNORMAL = 1 ' Restores Window if Minimized or Maximized

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 Declare Function FindExecutable Lib "shell32.dll" Alias _
   "FindExecutableA" (ByVal lpFile As String, ByVal lpDirectory As _
   String, ByVal lpResult As String) As Long

Public Sub LaunchWebSupport(sURL As String)
    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(0, "open", BrowserExec, _
          sURL, 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



Tue, 25 Mar 2003 14:49:23 GMT  
 link to the web (call browser)
Well, there is one way to do it, but I'm sure you can find some components
that will do it for you.
Add this line in the beginning of your code:

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

Then use it, as in the following example:

ShellExecute Me.hWnd, "open", "http://www.disney.com", "", "", 1

I grabbed this code from BoS source code I got from www.planetsourcecode.com
so they deserve all the credit. (well, them and the guys in microsoft who
made this thing ;-)

Quote:

> Hello!

> Is there a possibility to create an web-link within an vb-programm?

> (In the way winword or outlook..... do)

> Thanks!

> Andi Goering

> Sent via Deja.com http://www.deja.com/
> Before you buy.



Wed, 02 Apr 2003 09:18:16 GMT  
 
 [ 4 post ] 

 Relevant Pages 

1. Web Browser: Opening link in new Web Browser window

2. How to make my web browser as a default web browser

3. Link to web browser

4. Calling Web Browser

5. Calling the default web browser in Excel

6. Need to call Print Preview GUI in IE from Web Browser control

7. Call VB routine from HTML in web Browser control

8. Web Browser (Shdocvw.dll) - Calling from IE4 vbscript

9. Calling Web browsers from VB4

10. Calling Report from Web browser

11. Calling web browser

12. Calling the user's default Web browser in VB5

 

 
Powered by phpBB® Forum Software