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 strongm on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Opening another window in Visual C++

Status
Not open for further replies.

J3WU

Programmer
May 16, 2002
6
CA
Hello, I'm a new programmer to Visual C++. Currently I'm working on a project and am having trouble trying to figure out how I can open another form from the first one. Thanks for the help.
 
you can use the fonction "ShellExecute".
Here is a little example on how you can use it:

#include <windows.h>
#include <shellapi.h>
int APIENTRY WinMain(HINSTANCE hInstance,
HINSTANCE hPrevInstance,
LPSTR lpCmdLine,
int nCmdShow)
{
ShellExecute (NULL,&quot;open&quot;,&quot;path_to_file&quot;,NULL,NULL,SW_SHOWNORMAL);
return 0;
}

you need to replace path_to_file with the convenient path.
 
Thank you Leibnitz! But you answered another question of mine. Perhaps I wasn't very clear. On my main form I have a menu. I want the menu to open another form so that the user can manipulate my program's optoins. Any ideas?
 
u mean open a dialogbox...

Create one with ressource editor, then call it with
DialogBox().

the dialog need to have a windows procedre, but it would
return false, rather than calling DefWindowProc().
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top