473,395 Members | 1,915 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,395 software developers and data experts.

opening .htm file from VB


I want a (local) webpage to open on the click of a button in VB, does anyone
know how to do this

roy

netherlands
Jul 17 '05 #1
2 4239
use microsoft internet controls (reference, components)

instruction

WebBrowser.Navigate (sHtmlFile)
"Roy G. Vervoort" <ro**********@rojaal.nl> schreef in bericht
news:40*********************@news.xs4all.nl...

I want a (local) webpage to open on the click of a button in VB, does anyone know how to do this

roy

netherlands

Jul 17 '05 #2
Best bet would be the "ShellExecute" API call, which will open the local
page in whatever the current browser is defined as.

Toss the following code into a module called "ShellExec", and call it
as ShellExec.RunFile "local_webpage.htm" ...

Private Declare Function GetDesktopWindow Lib "user32" () 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
Public Const SW_SHOWNORMAL = 3
'-----------------------------------------------'
' '
' Use: '
' ShellExec.RunFile(filename As String) As Long '
' '
' Executes 'filename' via it's associated '
' program file. Great for external help. '
' '
'-----------------------------------------------'

Public Function RunFile(ByVal strDocName As String) As Long
Dim Scr_hDC As Long
Dim lngRes As Long
Scr_hDC = GetDesktopWindow()
RunAssociateFile = ShellExecute(Scr_hDC, "Open", strDocName, "", "C:\",
SW_SHOWNORMAL)
End Function

"Roy G. Vervoort" <ro**********@rojaal.nl> wrote in message
news:40*********************@news.xs4all.nl...

I want a (local) webpage to open on the click of a button in VB, does anyone know how to do this

roy

netherlands

Jul 17 '05 #3

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

5
by: PM | last post by:
Has anyone found a way to open a file exclusively where it will fail if the file is already open, i have tried the following _FileStream = new FileStream(@"C:\Data.txt", FileMode.Open,...
1
by: Alfons | last post by:
Hello, I have build a program that can do file transferring between a Windows XP computer and a DOS computer via a serial port. The Windows program I have build in C++ with Visual Studio 6.0....
14
by: D. Alvarado | last post by:
Hello, I am trying to open a window containing an image and I would like the image to be flush against the window -- i.e. have no padding or border. Can I make this happen with a single call to a...
5
by: Brad | last post by:
In several aspx applications I export crytal reports to pdf, xls and doc files and then the aspx page writes the selected export file to the client browser. This all works with one small quirk: ...
11
by: aldrin | last post by:
I'm trying to run this code under windows xp sp2 using codeblocks v1.0 compiler with great difficulty.There is no problem with running this under KDevelop in linux. Any help would be greatly...
2
by: Craig | last post by:
Hi there, I'm trying to open colour BMPs using PIL and I'm getting the following errors. Opening a 16 colour BMP I get: Traceback (most recent call last): File "<pyshell#3>", line 1, in...
9
compman9902
by: compman9902 | last post by:
Hello, and thank toy for reading this post. Thus far, this website has helped me a lot, (I have finally finished my encryptor: "site removed by moderator", go to the downloads link) and I will...
15
by: Umesh | last post by:
how to open a website like yahoo.com and use it as input? The following code doesn't work. #include"stdio.h" int main() { FILE *f; f=fopen("http://www.yahoo.com","r"); if(f==NULL)
1
by: Sanjeeva K kanakam | last post by:
Hi all, I am developing one application. In that i have created on report file which contains tables, titles and tree view list also by using HTML tags. I am opening this file in my application it...
34
by: Alexnb | last post by:
Gerhard Häring wrote: No, it didn't work, but it gave me some interesting feedback when I ran it in the shell. Heres what it told me: Traceback (most recent call last): File...
0
by: ryjfgjl | last post by:
In our work, we often receive Excel tables with data in the same format. If we want to analyze these data, it can be difficult to analyze them because the data is spread across multiple Excel files...
0
by: emmanuelkatto | last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud. Please let me know. Thanks! Emmanuel
0
BarryA
by: BarryA | last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
1
by: Sonnysonu | last post by:
This is the data of csv file 1 2 3 1 2 3 1 2 3 1 2 3 2 3 2 3 3 the lengths should be different i have to store the data by column-wise with in the specific length. suppose the i have to...
0
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers,...
0
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven...
0
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows...
0
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing,...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.