system("notepad") makes my game stop

Started by
4 comments, last by knowyourrole 17 years, 1 month ago
how do I run notepad from my game so my game keeps going and notepad is open?
Black Sky A Star Control 2/Elite like game
Advertisement
I guess system("notepad&"); would work, but I'm almost certain there is a better way. I'm not too experienced with Windows or Win32, but I guess it would be preferable to get the path from the registry and use a Win32 command to execute it.
#include <shellapi.h>

ShellExecute(NULL, "open", "notepad.exe", NULL, NULL, SW_SHOWNORMAL);
....[size="1"]Brent Gunning
You can use CreateProcess. Here's an example.
You might have to provide the full path, which is %windir%\system32\notepad.exe.

Edit: Yeah, ShellExecute is probably simpler.
yay, shellexecute worked thanks guys. lol I was trying createprocess but was doing it wrong.
Black Sky A Star Control 2/Elite like game
The reason your initial attempt didn't work was that you were executing it from the comamnd line in the wrong way. It should have been:
system("start notepad.exe c:/whatever.txt)";

This doesn't cause the program calling it to wait for the notepad window to close before execution continues.

This topic is closed to new replies.

Advertisement