![]() |
![]() |
|||||
![]() |
![]() |
![]() |
![]() |
![]() |
![]() |
|
Q: Open a website or HTML file using the default web browser.Answer: The ShellExecute function is the key to this FAQ. Both Netscape and Internet Explorer associate themselves with .HTM files. In fact, they seem to fight over this extension like two kids fighting over a piece of candy. ShellExecute can open a file using its associated program. Here's how: // include SHLOBJ.H in your CPP file. #include <shlobj.h> // open an HTML file on the hard drive. ShellExecute(Handle, "open", "d:\\website\\index.htm", NULL,NULL,SW_SHOWDEFAULT); // open a website directly ShellExecute(Handle, "open", "http://www.trgnet.com/bcb/index.htm", NULL,NULL,SW_SHOWDEFAULT); // open a website without knowing the name of its HTML home page file. ShellExecute(Handle, "open", "http://www.borland.com/", NULL,NULL,SW_SHOWDEFAULT); | ||||||
All rights reserved. |