Bonjour à tous,

Après de longues recherches, j'aimerais vous soumettre mon problème...

Alors j'essaye d’accéder à la zone texte d'un messageBox, malheureusement le messagebox qui se lance n'est pas un programme fils du programme principale. Auriez vous donc une autre solution pour accéder à cette fenêtre?

j'ai essayer ceci jusqu'a présent, sans succes.... il me donne les infos du programme père (principal) et ensuite ne trouve pas de programme fils (hwndChild == 0)

hwndChild = FindWindowEx(hwnd, IntPtr.Zero, null, null);
while (hwndChild != IntPtr.Zero)
{
GetWindowText(hwndChild, bld, 255);
Console.WriteLine(bld.ToString());
//SendMessage(hwndChild, WM_SYSCOMMAND, SC_CLOSE, 0);
hwndChild = FindWindowEx(hwnd, hwndChild, null, null);
}

OU

hwndChild = FindWindowEx(hwnd, IntPtr.Zero, null, null);
while (hwndChild != IntPtr.Zero)
{
IntPtr lgTexte = SendMessage(hwndChild, WM_GETTEXTLENGTH, 0, 0);
#if STRING
string sbTitre = new string('0',lgTexte);
#else
StringBuilder sbTitre = new StringBuilder((int)lgTexte);
#endif
GetControlText((int)hwndChild, WM_GETTEXT, (int)lgTexte + 1, sbTitre);
Console.WriteLine("hwnd={0} => {1}", hwndChild, sbTitre);
hwndChild = FindWindowEx(hwnd, hwndChild, null, null);
}