|
|
|
|
Posted 2002-11-05, 01:33 PM
in reply to Demosthenes's post "question about c."
|
|
|
|
mjordan2nd: Try this, should work in any c compiler that supports Win32. It'll run Notepad untill you quit it via the taskmanager.....
#include <windows.h>
int WINAPI WinMain(HINSTANCE handle,HINSTANCE dontcare,PSTR cli,int showflags);
int WINAPI WinMain(HINSTANCE handle,HINSTANCE dontcare,PSTR cli,int showflags) {
STARTUPINFO startup;
PROCESS_INFORMATION process;
GetStartupInfo(&startup); /* Just copy the current process startup info. */
do {
if (!CreateProcess("c:\\WINNT\\System32\\NotePad.EXE" ,NULL,NULL,NULL,FALSE,NORMAL_PRIORITY_CLASS,NULL,N ULL,&startup,&process)) {
MessageBox(NULL,"Can't launch app.","Applauncher",MB_ICONWARNING|MB_OK);
exit(1); /* can't create process, die. */
}
WaitForSingleObject(process.hProcess,INFINITE); /* Wait for the process to die. */
} while (1);
return 0;
}
Last edited by MrRooster; 2002-11-05 at 01:37 PM.
|
|
|
|
|
|
|
|
|
|
|