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"); }
Programming Tips - I want to display a local HTML file in the default browser.
Date: 2008jul17
Platform: win32
OS: Windows
Language: C/C++
Keywords: web, page, webpage, local
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: