Hi,
My code:
Code:
// error checking removed
// varibles
HWND hWndNews;
DWORD dwPid, error;
HANDLE hNews;
// process closed
hWndNews = FindWindow(NULL, "4.32 - Build: 4969");
dwPid = GetWindowThreadProcessId(hWndNews, NULL);
hNews = OpenProcess(PROCESS_ALL_ACCESS, FALSE, dwPid);
TerminateProcess(hNews, 0);
CloseHandle(hNews);
I am trying to terminate another application (MFC), by getting the handle, opening a process and terminating it. I have tried sending messages to the window but it dosnt work (WM_CLOSE/WM_DESTROY).
The handle is correct, although the dwPid contains 740 and spy++ says its 000007D0.
Anyone know how i can fix this/close the program?
Thanks alot,
Jack