
Getting window handle without matching window caption text
Wrong class name. The class name for the window will be something like:
"WindowsForms10.Window.8.app7e" even though the actual class name for your
form may be something like "WindowsApplication1.Form1" - but the class name
will be different for different versions of your app so don't count on it to
always be the same - I think it is assigned by the runtime since it is
"hosting" the app like in a virtual machine.
Use a windows spy app to see what the class name is to pass to FindWindow.
(I use Spy & Capture - freeware by Krichmar Kobi - you can get it here:
http://my.magicpage.co.il/Comp/kobik/download/spy.zip )
--
-Ryan
I am having trouble getting the window handle of a running application. I
do not want to match based on window caption text.
I have tried the following:
1) FindWindow - When I specify only the class name I get nothing in return.
Example: FindWindow("WindowsApplication1.Form1", null) returns IntPtr.Zero.
2) Process.GetProcessesByName - This gives me the process but I can't seem
to get the window handle from there. The MainWindowHandle property returns
IntPtr.Zero if the window is hidden or set to not visible.
3) EnumWindows - Cannot find a way to get the window handle without matching
on caption text.
Any ideas???
Greg