#include <stdio.h>
#include <windows.h>
void main(){
	STARTUPINFO sinfo;	//the startup information is a C struct used to pass a set of 
						//miscellaneous parameters regarding window characteristics and
						//redirection information for the console and keyboard.
	PROCESS_INFORMATION pinfo;				
	int status;
	GetStartupInfo(&sinfo);
	status = CreateProcess ("c:\\winnt\\system32\\notepad.exe", // lpApplicationName 
		NULL, // lpCommandLine 
		NULL, // lpProcessAttributes 
		NULL, // lpThreadAttributes 
		FALSE, // bInheritHandles,
		REALTIME_PRIORITY_CLASS|CREATE_NEW_CONSOLE,//dwCreationFlags 
		NULL, // lpEnvironment 
		NULL, // lpCurrentDirectory
		&sinfo, // lpStartupInfo 
		&pinfo // lpProcessInformation 
	);
	if (status == 0){
		fprintf (stderr, "Error creating new process, %d\n",
			GetLastError());
	} 
	else printf ("Created new process, procid=%d, threadid=%d\n",
		pinfo.dwProcessId, pinfo.dwThreadId);
	WaitForSingleObject(pinfo.hProcess,INFINITE);
}
