I am building an applicaton, It will get all control have into application winform is running. First, I can inject dll into application winform is running and get handle of application winform is running. After I get all child window into applcation. Next, I want get all controls into child window by FindWindowEx. But I can't
Here is code :
static ArrayList GetAllChildrenWindowHandles(IntPtr hParent, int maxCount)
{
ArrayList result = new ArrayList();
int ct = 0;
IntPtr prevChild = IntPtr.Zero;
IntPtr currChild = IntPtr.Zero;
while (true && ct < maxCount)
{
currChild = FindWindowEx(hParent, prevChild, null, null);
if (currChild == IntPtr.Zero)
{
int errorCode = Marshal.GetLastWin32Error();
break;
}
result.Add(currChild);
prevChild = currChild;
++ct;
}
return result;
}
I get a handle of child window and use it is parent. But I can't get all control into child window by FindWindowEx . Sorry for my english