opening apps from within apps
Does anybody know how I can open an application from within another application in C++ for windows?
I''ve trawled the VCC help files for ages, and I can''t find what I''m looking for. If anyone can help I''ll be a happy bunny .
____________________________________________________________www.elf-stone.com | Automated GL Extension Loading: GLee 5.00 for Win32 and Linux
It''s called ShellExecute isn''t it?
It also works for URL''s apparently (I''ve never used it)
George.
"Who says computer games affect kids, imagine if PacMan affected us as kids, we'd all sit around in a darkened room munching pills and listening to repetitive music....uh oh!"
It also works for URL''s apparently (I''ve never used it)
George.
"Who says computer games affect kids, imagine if PacMan affected us as kids, we'd all sit around in a darkened room munching pills and listening to repetitive music....uh oh!"
George. F"Who says computer games affect kids, imagine if PacMan affected us as kids, we'd all sit around in a darkened room munching pills and listening to repetitive music....uh oh!"
The function(s) you're looking for are CreateProcess() (or CreateProcessEx() )and possible GetExitCodeProcess() (if you're looking to wait for a process to finish executing).
Here's an example
----------------------------------
char cmdline[2048] = "";
PROCESS_INFORMATION p;
STARTUPINFO s;
DWORD exit_code;
BOOL ret;
sprintf(cmdline, "my_executable");
memset(&s, 0, sizeof(STARTUPINFO));
if(!CreateProcess(NULL, cmdline, NULL, NULL, FALSE, 0, NULL, NULL, &s, &p)){
return 0;
}
// wait for the process to finish
do {
Sleep(1); // make this loop multitasking friendly
ret = GetExitCodeProcess(p.hProcess, &exit_code);
} while((exit_code == STILL_ACTIVE) && (ret != 0));
(sorry for the poor formatting)
Edited by - daveb on 3/23/00 9:26:37 AM
Here's an example
----------------------------------
char cmdline[2048] = "";
PROCESS_INFORMATION p;
STARTUPINFO s;
DWORD exit_code;
BOOL ret;
sprintf(cmdline, "my_executable");
memset(&s, 0, sizeof(STARTUPINFO));
if(!CreateProcess(NULL, cmdline, NULL, NULL, FALSE, 0, NULL, NULL, &s, &p)){
return 0;
}
// wait for the process to finish
do {
Sleep(1); // make this loop multitasking friendly
ret = GetExitCodeProcess(p.hProcess, &exit_code);
} while((exit_code == STILL_ACTIVE) && (ret != 0));
(sorry for the poor formatting)
Edited by - daveb on 3/23/00 9:26:37 AM
Volition, Inc.
How about
system("c:\\yourfile.exe");
system("c:\\yourfile.exe");
"after many years of singularity, i'm still searching on the event horizon"
thanks. You''ve all given me something to play with anyway.
____________________________________________________________www.elf-stone.com | Automated GL Extension Loading: GLee 5.00 for Win32 and Linux
This topic is closed to new replies.
Advertisement
Popular Topics
Advertisement
Recommended Tutorials
Advertisement