Date: 2008jul17
Platform: win32
Q. I want to display a local HTML file in the default browser.
How can I simply do that.
A. Simulate the user clicking on it like this:
BOOL WebPage(const HWND hwndParent, LPCSTR szUrl)
{
return ShellExecute(hwndParent, "open", szUrl, NULL, NULL, SW_SHOWNORMAL) > (HINSTANCE) 32;
}
BOOL LocalWebPage(const HWND hwndParent, LPCSTR szFile)
{
char szUrl[MAX_PATH*2+1];
_snprintf(szUrl, sizeof(szUrl), "file://%s", szFile);
return WebPage(hwndParent, szUrl);
}
ExampleUse()
{
LocalWebPage(NULL, "c:\\temp\\hello.htm");
}
| What this info useful to you? You can donate to say thanks |
Add a comment
Sign in to add a comment