Returning application name from hWnd handle.

  • Thread starter Thread starter Paul Aspinall
  • Start date Start date
P

Paul Aspinall

Hi
I am trying to find the application from a hWnd handle.

ie. if the hWnd is to Internet explorer, I want to try to return
iexplore.exe (as per processes in Task Manager), or some other indicator
that its IE.

Can anyone help?

Thanks
 
Paul Aspinall said:
I am trying to find the application from a hWnd handle.

ie. if the hWnd is to Internet explorer, I want to try to return
iexplore.exe (as per processes in Task Manager), or some other indicator
that its IE.

Loop through the process list returned by
'System.Diagnostics.Process.GetProcesses' and compare the handle to the
'Process' objects' 'MainWindowHandle' property value.
 
Thanks for the reply.
I just found this, literally about 30 minutes ago, and got it working.

Thanks
 
I think you can probably answer this question for yourself.

In actuality, my news server never posted it after 1 hour, so I posted it
again, only to find that it posted them both 2 hours later.

Useful comment though.
 
The problem with MainWindowHandle is that there can only be one per
process, even though applications like Internet Explorer have multiple
top level windows in the same process.


Mattias
 
Back
Top