Bonjour,
Je cherche un moyen pour lister tous les tous les labels d'une form.
j'ai trouvé avec spy++ que le label que je cherche est le 6éme sur ma fenêtre .
Pour l'instant j'ai fait ça :
[DllImport("user32.dll", SetLastError = true)]
static extern IntPtr FindWindow(string lpClassName, string lpWindowName);
[DllImport("user32.dll", SetLastError = true)]
public static extern IntPtr FindWindowEx(IntPtr parentHandle, IntPtr childAfter, string className, string windowTitle);
[DllImport("user32.dll", SetLastError = true)]
static extern IntPtr GetWindow(IntPtr hWnd, GetWindow_Cmd uCmd);
enum GetWindow_Cmd : uint
{
GW_HWNDFIRST = 0,
GW_HWNDLAST = 1,
GW_HWNDNEXT = 2,
GW_HWNDPREV = 3,
GW_OWNER = 4,
GW_CHILD = 5,
GW_ENABLEDPOPUP = 6
}
IntPtr windowHandle ;
...
windowHandle = FindWindow(null, "Windows to look");
IntPtr child = GetWindow(windowHandle, GetWindow_Cmd.GW_CHILD | GetWindow_Cmd.GW_HWNDFIRST);
while (child != IntPtr.Zero)
{
child = GetWindow(child, GetWindow_Cmd.GW_HWNDNEXT);
}
Quelqu'un aurait il une solution qui pourrait me permettre de lire ce label
Merci