I'm with stupid

Started by
2 comments, last by SiCrane 18 years, 9 months ago
"MYPROG.exe" is your average Win32 exe who needs to be closed. "CLOSEIT.exe" is the program to do that. "CLOSEIT.exe" is uses the below code to try and terminate the application. "CLOSEIT.exe" fails. "CLOSEIT.exe" observes that "MYPROG.exe" doesn't have a window, and has no WNDCLASS (or WNDCLASSEX) registered. Code: DWORD pid = 0; HWND hWnd = FindWindow(NULL, "MYPROG.exe"); // I know it's wrong, whaddaya // think this thread is for! GetWindowThreadProcessId(hWnd, &pid); if(!TerminateProcess(OpenProcess(PROCESS_TERMINATE, false, pid), 0)) MessageBox(NULL, "Failed to close...", "Error", NULL); // code ends here "CLOSEIT.exe" needs some help.
A JPEG is worth a thousand and twenty four DWORD's. ;)
Note: Due to vacationing my website will not be updated till late-August. Of course I still have internet, but who wants to program during a vacation?
Advertisement
Wait, what are you talking about?
Rob Loach [Website] [Projects] [Contact]
He's asking how to go about communicating with a process that doesn't have a window. I'd answer, but I don't know off the top of my head and am too lazy to go look it up in the MSDN Library.
{[JohnE, Chief Architect and Senior Programmer, Twilight Dragon Media{[+++{GCC/MinGW}+++{Code::Blocks IDE}+++{wxWidgets Cross-Platform Native UI Framework}+++
Try using the CreateToolhelp32Snapshot() function. You can then walk the process list and find something with the right module name.

This topic is closed to new replies.

Advertisement