FindWindow() or similar to get name of .exe that is running

Hi, i'm trying to kill off several instances of Adobe's acrobat reader that are locked up or not responding properly using a C program. Each time a user presses the print button(from another application, not my own) a new instance opens up but the window caption for that instance of Adobe Reader is different than the one before it.

I want to know how to close all of the instances of Acrord32.exe or all of the Adobe Reader windows, as mentioned previously the problem i'm having is that the window captions have different names (ie. Adobe Reader - [73.pdf], Adobe Reader - [112.pdf], Adobe Reader - [2.pdf], etc...)
although the actual process name, as indicated by the task manager is always acrord32.exe.

I'm wondering if there's a way to either kill all of the acrord32.exe instances, or to perhaps use a wildcard or regular expression to match the "Adobe Reader - [" portion of the Window caption.

So far I've been able to use the following code to successfully get a handle to the window *IF* i know the complete window caption, but that is the problem that I don't know the complete caption as the numeric portion of the window caption is randomly generated.


int main(int argc, char *argv[])

//Struct to hold Window handle
HWND WindowHandle;

//this window's caption is Acrobat something or other
WindowHandle = FindWindow(NULL, "Adobe Reader - [73.pdf]");
if (WindowHandle == NULL) {
printf("The function failed to get the WindowHandle.
} else {
return 0;

Any help provided would be greatly appreciated :)


  • If you use EnumWindows() instead, you will get a handle to each process. From there you can get the hwnd and then send a WM_GETTEXT() to get the window name. Then compare it with the first part of the string, "Adobe Reader".
Sign In or Register to comment.

Howdy, Stranger!

It looks like you're new here. If you want to get involved, click one of these buttons!


In this Discussion