Hi everybody,
After long researches I want to submit you my problem...
I want to read the text of a MessageBox (or pop-up) window from an other program but the thing is, this MessageBox is not a child of his main program so i can't access to it...
this is what I tried without success...
hwndChild = FindWindowEx(hwnd, IntPtr.Zero, null, null);
while (hwndChild != IntPtr.Zero)
{
GetWindowText(hwndChild, bld, 255);
Console.WriteLine(bld.ToString());
hwndChild = FindWindowEx(hwnd, hwndChild, null, null);
}
OR
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);
}