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).
// error checking removed
DWORD dwPid, error;
// process closed
hWndNews = FindWindow(NULL, "4.32 - Build: 4969");
dwPid = GetWindowThreadProcessId(hWndNews, NULL);
hNews = OpenProcess(PROCESS_ALL_ACCESS, FALSE, dwPid);
The handle is correct, although the dwPid contains 740 and spy++ says its 000007D0.
Anyone know how i can fix this/close the program?