tags:

views:

41

answers:

1

I have an HDC object and I'd like to use it to get the name of the program that created it (such as Notepad or Firefox). Is there a way to do this?

If not, how can I do this?

+1  A: 
  1. WindowFromDC to get the window handle from the HDC
  2. GetWindowThreadProcessId to get the process ID from the window handle
  3. OpenProcess to obtain a process handle from the process ID
  4. GetProcessImageFileName to obtain the program's path from the process handle

Or, once you have the window handle, GetWindowText to get the window title.

Oren Trutner