Advertisement Jump to content
Sign in to follow this  
geekalert

I'm with stupid

This topic is 4929 days old which is more than the 365 day threshold we allow for new replies. Please post a new topic.

If you intended to correct an error in the post then please contact us.

Recommended Posts

"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.

Share this post


Link to post
Share on other sites
Advertisement
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.

Share this post


Link to post
Share on other sites
Try using the CreateToolhelp32Snapshot() function. You can then walk the process list and find something with the right module name.

Share this post


Link to post
Share on other sites
Sign in to follow this  

  • Advertisement
×

Important Information

By using GameDev.net, you agree to our community Guidelines, Terms of Use, and Privacy Policy.

GameDev.net is your game development community. Create an account for your GameDev Portfolio and participate in the largest developer community in the games industry.

Sign me up!