473,402 Members | 2,050 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,402 software developers and data experts.

How to call IE to open an HTML file from a C program ?

I have a user manual for my program in HTML format, and I want to open it
from my program by clicking a button.

How can I call the IE with my HTML file inside my program ?

Thanks,

Elga.
Nov 17 '05 #1
2 1466
=?Utf-8?B?RWxnYQ==?= wrote:
I have a user manual for my program in HTML format, and I want to open
it from my program by clicking a button.

How can I call the IE with my HTML file inside my program ?


See: ShellExecute
http://msdn.microsoft.com/library/en-
us/shellcc/platform/shell/reference/functions/shellexecute.asp

--
Greetings
Jochen

My blog about Win32 and .NET
http://blog.kalmbachnet.de/
Nov 17 '05 #2
"Elga" <El**@discussions.microsoft.com> wrote in message
news:B3**********************************@microsof t.com...
I have a user manual for my program in HTML format, and I want to open it
from my program by clicking a button.

How can I call the IE with my HTML file inside my program ?


I see that Jochen has already pointed you to the simplest solution.

If you need more control over the broswer you could use the ugly hack below
as a starting point to get up to speed on the browser object. My hack
demonstrates how to hide the address bar in the browser as an example.

Regards,
Will

#include <windows.h>
#include <exdisp.h>

int main()
{
BSTR bstrURL;
HRESULT hr;
VARIANT v;
VARIANT_BOOL vb;
IWebBrowser2 *pBrowser ;

hr = CoInitialize(NULL);

if ( SUCCEEDED(hr) )
{
hr = CoCreateInstance (CLSID_InternetExplorer, NULL, CLSCTX_LOCAL_SERVER,
IID_IWebBrowser2, (LPVOID *)&pBrowser);

if ( SUCCEEDED(hr) )
{
vb = FALSE;
pBrowser->put_AddressBar(vb);

bstrURL = SysAllocString(L"C:\\Readme.html");
v.vt = VT_EMPTY;
pBrowser->Navigate(bstrURL, &v, &v, &v, &v);
SysFreeString(bstrURL);

vb = TRUE;
pBrowser->put_Visible(vb);
}

CoUninitialize();
}

return 0;
}


Nov 17 '05 #3

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

Similar topics

10
by: Sanyi Benczik | last post by:
Is there a standard way in C++ to call an external program or is this platform dependent? If it is platform dependent, can somebody drop a line what to use or where to look for info for GNU C++...
1
by: Michael | last post by:
Hello, Not sure if this is the right message board but I have an interesting problem. Using Visual Studio .NET, C++, I want to write an all-encompassing C++ program to download new files from...
2
by: Tomy Jon | last post by:
Howdy What do I use to call a program in html, in a known directory, and then have control return to the next html step ? Thanks tom
1
by: Charlie | last post by:
I am trying to make an XMLHttpRequest which violates the default "same- origin"policy in Firefox. I checked the archives and found a method that should work but it does not. Below is the test code...
54
by: Zytan | last post by:
I have a log class that makes a synchronized TextWriter like so, in the constructor: StreamWriter sw = new StreamWriter(filename); tw = TextWriter.Synchronized(sw); In the destructor,...
13
by: Avi | last post by:
Hi, Is there a UNIX C system command that will let me copy a file? I am looking for something similar to "cp" that can be called within a C program. I know of the "link" system call but this...
3
by: BASSPU03 | last post by:
Private Sub FilePath_Click() Rem Me! Dim stAppName As String Dim stlink As String stlink = Me! stAppName = "C:\Program Files\Internet Explorer\IEXPLORE.EXE...
2
by: malcster2 | last post by:
hello, i am a beginner to ajax. i have created a mysql database, which i would like to access from a web page. i have created 3 files, a html to display the data, a php file to extract the data,...
35
by: jleslie48 | last post by:
I've written a cgi program in C using the borland 5.5 free compiler, and it runs just fine on an Apache server. My only issue is if I issue some system calls the cgi suspends until the call...
0
by: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
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...
0
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However,...
0
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can...
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
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each...
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,...
0
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome a new...

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.