×
INTELLIGENT WORK FORUMS
FOR COMPUTER PROFESSIONALS

Contact US

Log In

Come Join Us!

Are you a
Computer / IT professional?
Join Tek-Tips Forums!
  • Talk With Other Members
  • Be Notified Of Responses
    To Your Posts
  • Keyword Search
  • One-Click Access To Your
    Favorite Forums
  • Automated Signatures
    On Your Posts
  • Best Of All, It's Free!

*Tek-Tips's functionality depends on members receiving e-mail. By joining you are opting in to receive e-mail.

Posting Guidelines

Promoting, selling, recruiting, coursework and thesis posting is forbidden.

Students Click Here

Borland C++ 3 (standard) Builder

Borland C++ 3 (standard) Builder

Borland C++ 3 (standard) Builder

(OP)
I am a beginner with Borland C++ 3 (standard) Builder
And have a question:

Is it possible to launch a browser from a form?
and if so How??

RE: Borland C++ 3 (standard) Builder

You can use the API function CreateProcess to start any program you want:

The CreateProcess function creates a new process and its primary thread. The new process executes the specified executable file.

BOOL CreateProcess(

    LPCTSTR lpApplicationName, // pointer to name of executable module
    LPTSTR lpCommandLine, // pointer to command line string
    LPSECURITY_ATTRIBUTES lpProcessAttributes, // pointer to process security attributes
    LPSECURITY_ATTRIBUTES lpThreadAttributes, // pointer to thread security attributes
    BOOL bInheritHandles, // handle inheritance flag
    DWORD dwCreationFlags, // creation flags
    LPVOID lpEnvironment, // pointer to new environment block
    LPCTSTR lpCurrentDirectory, // pointer to current directory name
    LPSTARTUPINFO lpStartupInfo, // pointer to STARTUPINFO
    LPPROCESS_INFORMATION lpProcessInformation // pointer to PROCESS_INFORMATION  
   );


Kim_Christensen@telus.net
Home Page

RE: Borland C++ 3 (standard) Builder

(OP)
Thanks zBuilder for you Answer but still I am a tight beginner  and by that wery unfamiliar to some codes and program combinations....
So far I am trying to make a simple HTML form to create Internet capable sites easy..... So for so good.. ;/
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.

RE: Borland C++ 3 (standard) Builder

Ahhh... Ok. you wanna find the default browser and open an HTML file with it? Then ShellExecute is what you want:

#include <shellapi.h>
ShellExecute( hwnd,"open","\\temp\\agent.htm", NULL, "\\temp", SW_SHOWMAXIMIZED);

The above code will open the file "agent.htm" 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.


Kim_Christensen@telus.net
Home Page

RE: Borland C++ 3 (standard) Builder

OOOppps! Win95 likes the FULL path to the file-  include the drive letter like so: If its on C drive that is

ShellExecute( hwndMain,NULL,"agent.htm", NULL, "C:\\temp", SW_SHOWMAXIMIZED);


Kim_Christensen@telus.net
Home Page

Red Flag This Post

Please let us know here why this post is inappropriate. Reasons such as off-topic, duplicates, flames, illegal, vulgar, or students posting their homework.

Red Flag Submitted

Thank you for helping keep Tek-Tips Forums free from inappropriate posts.
The Tek-Tips staff will check this out and take appropriate action.

Reply To This Thread

Posting in the Tek-Tips forums is a member-only feature.

Click Here to join Tek-Tips and talk with other members! Already a Member? Login

Close Box

Join Tek-Tips® Today!

Join your peers on the Internet's largest technical computer professional community.
It's easy to join and it's free.

Here's Why Members Love Tek-Tips Forums:

Register now while it's still free!

Already a member? Close this window and log in.

Join Us             Close