|
dev
newsgroups
|
|||||||||||||||||||||||
|
|||||||||||||||||||||||
Returning application name from hWnd handle.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" <p***@aspy.co.uk> schrieb: Loop through the process list returned by > 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. 'System.Diagnostics.Process.GetProcesses' and compare the handle to the 'Process' objects' 'MainWindowHandle' property value. -- M S Herfried K. Wagner M V P <URL:http://dotnet.mvps.org/> V B <URL:http://classicvb.org/petition/> Thanks for the reply.
I just found this, literally about 30 minutes ago, and got it working. Thanks Show quote "Herfried K. Wagner [MVP]" <hirf-spam-me-here@gmx.at> wrote in message news:uiw9EaURGHA.4264@TK2MSFTNGP11.phx.gbl... > "Paul Aspinall" <p***@aspy.co.uk> schrieb: >> 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. > > -- > M S Herfried K. Wagner > M V P <URL:http://dotnet.mvps.org/> > V B <URL:http://classicvb.org/petition/> 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 -- Mattias Sjögren [C# MVP] mattias @ mvps.org http://www.msjogren.net/dotnet/ | http://www.dotnetinterop.com Please reply only to the newsgroup. |
|||||||||||||||||||||||