Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations SkipVought on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

How do you start I.E. from a VB3 app?

Status
Not open for further replies.

StuH

Programmer
Mar 25, 2001
53
0
0
AU
Hi all,

I really need to know urgently what the procedure is for starting Internet Explorer (32 bit) from a VB3 program, and telling it to display a htm file from a location on disk.

Alternatively, to have the VB3 app specify a disk-based htm file to be opened by whatever the PCs default browser is.

Anyone know how to do this?

Thanks,

Stu.

 
There is only 2 popular Internet browsers that i know of, and this is what I do. I would assign a on error goto to pickup if the first program, in this case, MSIE (C:\Progra~1\Micros~?\IEXPLORE.EXE filename), then if that failed to run (FILE NOT FOUND ERROR), go ahead and execute the file under netscape(unshure of the default folder...sorry).Then if that doesn't work, just keep executing other browsers (they could have Arachne C:\Arachne\Arachne.exe filename) until one is found/ or not found. BTW, what do you need to open a HTML file for anyways... E-MAIL:AWAL_US@YAHOO.CA
 
Hi AWal,

Thanks for your reply. I'll give it a go - I need it
to display a disk based help system done in html.

If there is any other way, I'd still like to know, particularly by specifying a htm and having it open the default browser.

Stu.
 
The easiest way is just to shell the html file. It will use whatever program is assigned to that file extension. Peter Meachem
peter@accuflight.com
 
Try the following:

Form Declarations:

Declare Function GetDesktopWindow Lib "USER" () As Integer

Declare Function ShellExecuteBynum Lib "SHELL" Alias "ShellExecute" (ByVal hwnd%, ByVal lpszOpp&, ByVal lpszFile$, ByVal lpszParamss&, ByVal lpszDir$, ByVal fsShowCmd%) As Integer

Const SW_SHOWNORMAL = 1



Form Subs:

Sub UpdateHelp_Click ()
Dim r As Integer
'---- Display DSS Web Site
Temp$ = " r = StartFile(Temp$)
If r < 33 Then
ErrorMessage1 r, &quot;Benefits Calculator Web Site&quot;
End If
'---- End Display DSS Web Site
End Sub


Function StartFile (DocName As String) As Integer
'---- Display Internet Page
Dim Scr_hDC As Integer
Scr_hDC = GetDesktopWindow()
StartFile = ShellExecuteBynum(Scr_hDC, 0&, DocName, 0&, Left$(APP.Path, 1) & &quot;:\&quot;, SW_SHOWNORMAL)
'---- End Internet Page
End Function


Sub ErrorMessage1 (ErrorNumber%, WebSite$)
'---- Display Error Message
Temp$ = &quot;error occurred when Windows was attempting to access the &quot; & WebSite$ & &quot; Website.&quot;
Select Case ErrorNumber%
Case 0
Msg$ = &quot;Insufficient system memory or corrupt program file &quot; & Temp$
Case 2
Msg$ = &quot;File not found &quot; & Temp$
Case 3
Msg$ = &quot;Invalid Path &quot; & Temp$
Case 5
Msg$ = &quot;Sharing or protection error &quot; & Temp$
Case 6
Msg$ = &quot;Separate data segments are required for each task &quot; & Temp$
Case 8
Msg$ = &quot;Insufficient memory to run the program &quot; & Temp$
Case 10
Msg$ = &quot;Incorrect Windows version &quot; & Temp$
Case 11
Msg$ = &quot;Invalid program file &quot; & Temp$
Case 12
Msg$ = &quot;Program file requires a different operating system &quot; & Temp$
Case 13
Msg$ = &quot;Program requires MS-DOS 4.0 &quot; & Temp$
Case 14
Msg$ = &quot;Unknown program file type &quot; & Temp$
Case 15
Msg$ = &quot;Windows program does not suppport protected memory mode &quot; & Temp$
Case 16
Msg$ = &quot;Invalid use of data segments when loading a second instance of a program &quot; & Temp$
Case 19
Msg$ = &quot;Attempt to run a compressed program file &quot; & Temp$
Case 20
Msg$ = &quot;Invalid dynamic link library &quot; & Temp$
Case 21
Msg$ = &quot;Program requires Windows 32-bit extensions &quot; & Temp$
Case Else
Msg$ = &quot;An unknown &quot; & Temp$
End Select
Title$ = &quot;CANNOT ACCESS INTERNET&quot;
MsgBox Msg$ & Chr$(13) & Chr$(13) & Str$(ErrorNumber%), 16, Title$
'---- End Display Error Message
End Sub
 
That's very full.

I'm not sure why you need the desktopwindow bit.

Declare Function ShellExecuteBynum Lib &quot;SHELL&quot; Alias &quot;ShellExecute&quot; (ByVal hwnd%, ByVal lpszOpp&, ByVal lpszFile$, ByVal lpszParamss&, ByVal lpszDir As Any, ByVal fsShowCmd%) As Integer


StartFile = ShellExecuteBynum(0&, 0&, &quot; 0&, 0&, 1)

works for me. Your error list is very impressive, and I'm sure quite correct. Any of those error messages would frighten the life out of my customers. They seem to prefer something a little more soothing.
Peter Meachem
peter@accuflight.com
 
Nice... I didn't even think of that :-{} -<AHH| E-MAIL:AWAL_US@YAHOO.CA
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top