Basically I am looking for a win32 method to invoke in C# to set the focus to a children of an unmanaged application.
But first I need to find the child control's handle which is the problem. Any useful win32 functions to solve this?
Basically I am looking for a win32 method to invoke in C# to set the focus to a children of an unmanaged application.
But first I need to find the child control's handle which is the problem. Any useful win32 functions to solve this?
There is a library which supports enumerating and searching window handles, which is available at http://mwinapi.sourceforge.net/
Just so that you do not have to reinvent the wheel every time ;)
Start with
SystemWindow.AllToplevelWindows
and then just dig your way down (looking at class names, process names, titles, dialog IDs, whatever).
Use FindWindowEx to find the Handle of the Window you're looking for. Once you have that handle, use EnumChildWindows to find the correct child you need. There's too much code involved for me to quickly write up a sample, but there's enough on the web to help.
From Pinvoke.net: http://www.pinvoke.net/default.aspx/user32/EnumChildWindows.html