Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations SkipVought on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Borland C++ 3 (standard) Builder

Status
Not open for further replies.

801119

Programmer
Apr 10, 2000
311
0
0
SE
I am a beginner with Borland C++ 3 (standard) Builder<br>And have a question:<br><br>Is it possible to launch a browser from a form?<br>and if so How??
 
You can use the API function CreateProcess to start any program you want:<br><br>The CreateProcess function creates a new process and its primary thread. The new process executes the specified executable file. <br><br>BOOL CreateProcess(<br><br>&nbsp;&nbsp;&nbsp;&nbsp;LPCTSTR lpApplicationName, // pointer to name of executable module <br>&nbsp;&nbsp;&nbsp;&nbsp;LPTSTR lpCommandLine, // pointer to command line string<br>&nbsp;&nbsp;&nbsp;&nbsp;LPSECURITY_ATTRIBUTES lpProcessAttributes, // pointer to process security attributes <br>&nbsp;&nbsp;&nbsp;&nbsp;LPSECURITY_ATTRIBUTES lpThreadAttributes, // pointer to thread security attributes <br>&nbsp;&nbsp;&nbsp;&nbsp;BOOL bInheritHandles, // handle inheritance flag <br>&nbsp;&nbsp;&nbsp;&nbsp;DWORD dwCreationFlags, // creation flags <br>&nbsp;&nbsp;&nbsp;&nbsp;LPVOID lpEnvironment, // pointer to new environment block <br>&nbsp;&nbsp;&nbsp;&nbsp;LPCTSTR lpCurrentDirectory, // pointer to current directory name <br>&nbsp;&nbsp;&nbsp;&nbsp;LPSTARTUPINFO lpStartupInfo, // pointer to STARTUPINFO <br>&nbsp;&nbsp;&nbsp;&nbsp;LPPROCESS_INFORMATION lpProcessInformation // pointer to PROCESS_INFORMATION&nbsp;&nbsp;<br>&nbsp;&nbsp;&nbsp;); <br> <p> <br><a href=mailto:Kim_Christensen@telus.net>Kim_Christensen@telus.net</a><br><a href= Page</a><br>
 
Thanks zBuilder for you Answer but still I am a tight beginner&nbsp;&nbsp;and by that wery unfamiliar to some codes and program combinations....<br>So far I am trying to make a simple HTML form to create Internet capable sites easy..... So for so good.. ;/<br>My main problem is to launche the Browser with a file that is temporarily saved in the program location.. to save is not the problem, but launce the file.... If not to much to ask... please write a quick code that uses a button to launch a browese i.e. Internet Explorer or Netscape.
 
Ahhh... Ok. you wanna find the default browser and open an HTML file with it? Then ShellExecute is what you want: <br><br>#include &lt;shellapi.h&gt;<br>ShellExecute( hwnd,&quot;open&quot;,&quot;\\temp\\agent.htm&quot;, NULL, &quot;\\temp&quot;, SW_SHOWMAXIMIZED);<br><br>The above code will open the file &quot;agent.htm&quot; in the directory \temp using the default browser. hwnd is the handle of the parent window (your application). Checking the return value of ShellExecute will let you know what caused it to fail if nothing happens. <p> <br><a href=mailto:Kim_Christensen@telus.net>Kim_Christensen@telus.net</a><br><a href= Page</a><br>
 
OOOppps! Win95 likes the FULL path to the file-&nbsp;&nbsp;include the drive letter like so: If its on C drive that is<br><br>ShellExecute( hwndMain,NULL,&quot;agent.htm&quot;, NULL, <b>&quot;C:\\temp&quot;</b>, SW_SHOWMAXIMIZED); <p> <br><a href=mailto:Kim_Christensen@telus.net>Kim_Christensen@telus.net</a><br><a href= Page</a><br>
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top