Home All Groups Group Topic Archive Search About

Returning application name from hWnd handle

Author
11 Mar 2006 4:44 PM
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

Author
11 Mar 2006 5:19 PM
Mattias Sjögren
>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?

You may be able to accomplish that with the System.Disgnostics.Process
class, but a more straight forward way is to call the the
GetWindowModuleFileName Win32 API.


Mattias

--
Mattias Sjögren [C# MVP]  mattias @ mvps.org
http://www.msjogren.net/dotnet/ | http://www.dotnetinterop.com
Please reply only to the newsgroup.
Author
11 Mar 2006 6:49 PM
Paul Aspinall
Hi
I've tried to call this, but it doesn't seem to return the details of
everthing. ie. it only returns the details on some hWnd , and not on others.

Any ideas?

Thanks


Show quote
"Mattias Sjögren" <mattias.dont.want.spam@mvps.org> wrote in message
news:%23V%23aVATRGHA.1204@TK2MSFTNGP12.phx.gbl...
> >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?
>
> You may be able to accomplish that with the System.Disgnostics.Process
> class, but a more straight forward way is to call the the
> GetWindowModuleFileName Win32 API.
>
>
> Mattias
>
> --
> Mattias Sjögren [C# MVP]  mattias @ mvps.org
> http://www.msjogren.net/dotnet/ | http://www.dotnetinterop.com
> Please reply only to the newsgroup.
Author
12 Mar 2006 10:08 PM
Mattias Sjögren
>I've tried to call this, but it doesn't seem to return the details of
>everthing. ie. it only returns the details on some hWnd , and not on others.
>
>Any ideas?

Yeah you're right it does seem a bit goofy. Apparently it only works
properly on Windows 9x. :(

You can also use GetWindowThreadProcessId to get the process the
window belongs to and then get more information from there.


Mattias

--
Mattias Sjögren [C# MVP]  mattias @ mvps.org
http://www.msjogren.net/dotnet/ | http://www.dotnetinterop.com
Please reply only to the newsgroup.

AddThis Social Bookmark Button