View Single Post
 
Reply
Posted 2002-11-05, 12: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 12:37 PM.
Old
Profile PM WWW Search
MrRooster is neither ape nor machine; has so far settled for the in-betweenMrRooster is neither ape nor machine; has so far settled for the in-between
 
MrRooster