Home | Contact Us | FAQ | Search & Site Map | Link to Us
Sign In | Join | Other 45 Sites in Network
HomeAnnouncementsFree MagazinesWhite PapersSubmit Content
Discussion GroupsASP.NETWindows FormsLanguages.NET FrameworkVisual Studio.NET
Articles.NET FrameworkASP.NETToolsWindows Forms
.NET DirectoryOpen Source ProjectsUser GroupsWeb Resources
Related Topics
Visual Basic 6SQL ServerMS AccessOther DB ProductsMS Server ProductsMore Topics ...

.NET Forum / .NET Framework / New Users / March 2006

Tip: Looking for answers? Try searching our database.

Returning application name from hWnd handle

Thread view: 
Enable EMail Alerts  Start New Thread
Thread rating: 
Paul Aspinall - 11 Mar 2006 16:44 GMT
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
Mattias Sjögren - 11 Mar 2006 17:19 GMT
>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

Signature

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

Paul Aspinall - 11 Mar 2006 18:49 GMT
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

> >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
[quoted text clipped - 7 lines]
>
> Mattias
Mattias Sjögren - 12 Mar 2006 23:08 GMT
>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

Signature

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


Free Magazines

Get these publications absolutely FREE for up to 12 months. There are no hidden fees and no obligation. Simply choose a title, complete the application form and submit it. Read more ...

Oracle MagazineNetwork ComputingComputer WorldBio-IT WorldeWeekInformation WeekInfosecurity
 
Sign In
Join
My Latest Posts
My Monitored Threads
My Blog
My Photo Gallery
My Profile
My Homepage

Start New Thread
Enable EMail Alerts
Rate this Thread



©2008 Advenet LLC   Privacy Policy - Terms of Use
This website includes both content owned or controlled by Advenet as well as content owned or controlled by third parties.