Wrox Home  
Search P2P Archive for: Go

  Return to Index  

pro_vb thread: IE


Message #1 by "Nagendra Kumar K" <knagendrak@h...> on Sat, 25 Jan 2003 11:09:34 +0000
Try this code

    Dim Dummy As String
    Dim BrowserExec As String * 255
    Dim retval As Long
    Const SW_SHOWNORMAL = 1
    Dim sFileName As String
    
    sFileName = "any file.htm"
    retval = FindExecutable(sFileName, Dummy, BrowserExec)
    BrowserExec = Trim(BrowserExec)

    ' If an application is found, launch it!
    If retval <= 32 Or IsEmpty(BrowserExec) Then ' Error
        ' MsgBox "Could not find a browser"
    Else
        retval = ShellExecute(Me.hwnd, "open", BrowserExec,
"http://www.mksoftware.com", Dummy, SW_SHOWNORMAL)
        If retval <= 32 Then        ' Error
            ' MsgBox "Web Page not Opened"
        End If
    End If

 And of course, put following somewhere:

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


Gavin

-----Original Message-----
From: Nagendra Kumar K [mailto:knagendrak@h...] 
Sent: Saturday, January 25, 2003 6:10 AM
To: professional vb
Subject: [pro_vb] IE

Hei,

Can anybody tell me how to open IE from VB. I want to display a .htm file in

IE without using browser control.

Thanks & Regards

Nag K.


_________________________________________________________________
MSN 8 with e-mail virus protection service: 2 months FREE* 
http://join.msn.com/?page=features/virus



  Return to Index