Originally Posted by
vart
Thank you very much vart and Yarin.
So before getting into trying to create a keyboard hook to the second application to disable a few of it's keys, I created the second application using:
Code:
STARTUPINFO si;
PROCESS_INFORMATION pi;
ZeroMemory (&si,sizeof(si));
si.cb = sizeof(si);
ZeroMemory (&pi,sizeof(pi));
if (!CreateProcess(L"Game.exe", NULL,NULL,NULL,FALSE,0,NULL,NULL,&si,&pi))
{
cout << "Unable to execute Game.exe.";
}
Now within my while loop in my main() function I've put:
Code:
bool IsClosing = GetExitCodeProcess(pi.hProcess,appstatusifitsclosing);
if(IsClosing == true)
{
//Exit App (main() is a bool)
return false;
}
Which I've assumed will check every frame and see if the Game.exe process is closing. I can't understand how to use it from here, or why it's not working...
I'm kind of a noob to all of this so I don't think I've defined lpExitCode correctly as well...
EDIT:
I've fixed the code, but it's still not working. The following is placed inside a loop:
Code:
DWORD ExitDword = 0;
if (GetExitCodeProcess(pi.hProcess,&ExitDword) == FALSE)
{
//Exit App
return false;
}