Reputation: 35
I can get handles using mouse location by clicking. But i need to find handles of all controls on a window using it's classname without clicking. I have to get them, while the window opened. Is it possible?
Upvotes: 0
Views: 2340
Reputation: 1816
you can combine two popular API's:
[DllImport("user32.Dll")]
private static extern Boolean EnumChildWindows(int hWndParent, PChildCallBack lpEnumFunc, int lParam);
This function is for getting all "child" windows inside a window. The second one is
[DllImport("User32.Dll")]
private static extern void GetClassName(int hWnd, StringBuilder s, int nMaxCount);
Use this method to filter whether the enummed window has a specific class name.
Happy coding!
Upvotes: 1
Reputation: 29668
Yes, you need to use a variety of API calls, starting with EnumWindows and probably GetClassName as well.
Upvotes: 0