By using this site, you agree to our updated Privacy Policy and our Terms of Use. Manage your Cookies Settings.
425,910 Members | 1,034 Online
Bytes IT Community
+ Ask a Question
Need help? Post your question and get tips & solutions from a community of 425,910 IT Pros & Developers. It's quick & easy.

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

P: n/a
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
Share this Question
Share on Google+
2 Replies


P: n/a
=?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

P: n/a
"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 discussion thread is closed

Replies have been disabled for this discussion.