|
-
May 6th, 1999, 08:31 AM
#1
Find Windows By Exe Name
How can I find HWND by executable name, or executable name by window HWND?
Thanks.
-
May 6th, 1999, 08:39 AM
#2
Re: Find Windows By Exe Name
Get exename from hWnd: GetWindowModuleFileName
Get hwnd from exename:
dont think there is a direct way.
You could do an EnumWindows and for each window call GetWindowModuleFileName and see if it is the same as the one you want, then save the current hWnd somewhere. This is not very accurate though as a module could have more than one main window (which is probably why there is no API to do it ;-).
Also, when you get the window handle, you will have to make sure that it is the main window, and not a modal dialog currently running in the app.
-
May 7th, 1999, 01:24 AM
#3
Re: Find Windows By Exe Name
This is exactly that I need. Thanks a lot.
Actually, first variant suits me perfectly.
I need to find .exe name from window's HWND.
But, in MSDN I found next:
[This is preliminary documentation and subject to change]. Maybe it won't work on some PC's?
Bye.
Thanks,
Ilgar Mashayev
-
May 12th, 1999, 05:26 PM
#4
Re: Find Windows By Exe Name
There actually IS an API for that!!
From VC++4 and upper, you can use:
ToolHelp functions for Win95 and WinNT5 (2000?)
PSAPI.DLL for WinNT4 from the WinNT4 DDK
Uli
Posting Permissions
- You may not post new threads
- You may not post replies
- You may not post attachments
- You may not edit your posts
-
Forum Rules
|
Click Here to Expand Forum to Full Width
|