|
code
newsgroups
|
|||||||||||||||||||||||
|
|||||||||||||||||||||||
Run IE from VB6 ?Does anybody know how, from VB 6 , I can run Internet Explorer and show an
htm file from the disk drive ? I'm using Windows XP Thanks, Jennifer ShellExecute
'// Declares 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 '// Form code Private Sub Command1_Click() Dim strURL As String strURL = "http://www.microsoft.com" ShellExecute hwnd, "open", strURL, vbNullString, vbNullString, vbNormalFocus End Sub Show quoteHide quote "Jennifer W" <jennif***@beyonddoubt.net> wrote in message news:eVKYXZWYFHA.2348@TK2MSFTNGP14.phx.gbl... > Does anybody know how, from VB 6 , I can run Internet Explorer and show an > htm file from the disk drive ? > > I'm using Windows XP > > Thanks, Jennifer > > The following opens a file named kmhelp.htm located in C:\Gnupg\Help\kmhelp.htm
Rename files and paths as needed. Option Explicit Public Declare Function GetDesktopWindow Lib "user32" () As Long Const SW_SHOWNORMAL = 1 Const SE_ERR_FNF = 2& Const SE_ERR_PNF = 3& Const SE_ERR_ACCESSDENIED = 5& Const SE_ERR_OOM = 8& Const SE_ERR_DLLNOtfOUND = 32& Const SE_ERR_SHARE = 26& Const SE_ERR_ASSOCINCOMPLETE = 27& Const SE_ERR_DDETIMEOUT = 28& Const SE_ERR_DDEFAIL = 29& Const SE_ERR_DDEBUSY = 30& Const SE_ERR_NOASSOC = 31& Const ERROR_BAD_FORMAT = 11& Public Declare Function ShellExecute Lib "shell32.dll" Alias _ "ShellExecuteA" (ByVal hwnd As Long, ByVal lpszOp As _ String, ByVal lpszFile As String, ByVal lpszParams As String, _ ByVal lpszDir As String, ByVal FsShowCmd As Long) As Long Private Sub Command1_Click() Dim seehlp As Long, msg As String seehlp = showhelp("kmhelp.htm") End Sub Private Function showhelp(DocName As String) As Long Dim Scr_hDC As Long Scr_hDC = GetDesktopWindow() showhelp = ShellExecute(hwnd, "open", "iexplore.exe", _ " C:\Gnupg\Help\kmhelp.htm", vbNullString, 10) End Function -- Show quoteHide quoteSteve Easton Microsoft MVP FrontPage 95isalive This site is best viewed............ ........................with a computer "Jennifer W" <jennif***@beyonddoubt.net> wrote in message news:eVKYXZWYFHA.2348@TK2MSFTNGP14.phx.gbl... > Does anybody know how, from VB 6 , I can run Internet Explorer and show an > htm file from the disk drive ? > > I'm using Windows XP > > Thanks, Jennifer > > "Jennifer W" <jennif***@beyonddoubt.net> wrote in If you want to do it in-process and with events, look at adding a news:eVKYXZWYFHA.2348@TK2MSFTNGP14.phx.gbl: > Does anybody know how, from VB 6 , I can run Internet Explorer and > show an htm file from the disk drive ? > > I'm using Windows XP > > Thanks, Jennifer > > WebBrowser control to a form. Reference Component: Microsoft Internet Controls (shdocvw.dll) Usage: WebBrowser1.Navigate "www.windows.com" "Jennifer W" <jennif***@beyonddoubt.net> wrote Here is one method:> Does anybody know how, from VB 6 , I can run Internet Explorer and show an > htm file from the disk drive ? > > I'm using Windows XP Private Sub Command1_Click() With CreateObject("InternetExplorer.Application") .Navigate2 "D:\temp\choose.htm" .Visible = True End With End Sub LFS Larry Serflaten wrote:
Show quoteHide quote > "Jennifer W" <jennif***@beyonddoubt.net> wrote Leave it to you, to come up with that! <g>>> Does anybody know how, from VB 6 , I can run Internet Explorer and >> show an htm file from the disk drive ? >> >> I'm using Windows XP > > Here is one method: > > Private Sub Command1_Click() > With CreateObject("InternetExplorer.Application") > .Navigate2 "D:\temp\choose.htm" > .Visible = True > End With > End Sub (Just *trying* to piss off all the Firefox users, are ya? <bg>) >"Jennifer W" <jennif***@beyonddoubt.net> wrote How 'bout this:> Does anybody know how, from VB 6 , I can run Internet Explorer and show an > htm file from the disk drive ? > > I'm using Windows XP Option Explicit 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 Sub Command1_Click() ShellExecute 0&, vbNullString, "C:\MyFolder\MyFile.htm", vbNullString, vbNullString, vbNormalFocus End Sub hi Jennifer,
You can instantiate IE by either early or late-binding. The late-binding version is: Set oIE = CreateObject("InternetExplorer.Application") This is probably not necessary: oIE.Visible = True To show an html page: oIE.Navigate("myPath\myFile.htm") InternetExplorer has an "automation interface" which you can read about on msdn. In short, you can do anything from vb that you can do using IE with a mouse and keybd. cheers, jw Jennifer W wrote: Show quoteHide quote > Does anybody know how, from VB 6 , I can run Internet Explorer and show an > htm file from the disk drive ? > > I'm using Windows XP > > Thanks, Jennifer > > |
|||||||||||||||||||||||