What Win32Api functions can I use to get some dialog box text? (for example if I have the handle of some error message dialog, how can I know what its error message?)
Thank you.
What Win32Api functions can I use to get some dialog box text? (for example if I have the handle of some error message dialog, how can I know what its error message?)
Thank you.
Dialog boxes don't actually contain text - they contain other controls which contain the text. You must enumerate or otherwise find the appropriate child window of the dialog box, and get its text with GetWindowText.
If I correct understand your question, your problem is very easy. Try Spy++ from Visual Studio tools. Then press Ctrl + F to receive a dialog for finding windows. Drag & drop of "Finder tool" on the control inside of Dialog Box from which you want to read a text and then look at properties of the window. The field "Control ID" is what you need.
If you have a handle of the Dialog Window (HWND hDlg) you should use GetDlgItemTex
t function (see http://msdn.microsoft.com/en-us/library/ms645489(VS.85).aspx)
UINT GetDlgItemText(HWND hDlg,
int nIDDlgItem,
LPTSTR lpString,
int nMaxCount
);
to read the text. As a nIDDlgItem
parameter you should place the identifier of the control. It is the value which you have found before with respect of Spy++