Can you tell me how to set from code a window dialog caption?
I have tried to use GetDlgItem to get the reference of the window and SetWindowText to set the string but it gives me an error.
Printable View
Can you tell me how to set from code a window dialog caption?
I have tried to use GetDlgItem to get the reference of the window and SetWindowText to set the string but it gives me an error.
The question is rather unclear here, from things it seems that you donot have a pointer to your dialog instance.... is it so??
if yes ...
I doubt the use of GetDlgItem for finding something in a window, but the case here is that u are on a lookout for the dialog itself, wouldnt it be strange to use GetDlgItem() for finding a dialog.
Use EnumChildWindows() and find the dialog if you donot have the reference to the dialog. winth any matching criteria like the class name or anyother property.
otherwise clear the question by elaborating a little, also give the error information.
cheers
Excuse me you're right
CWnd *a;
a=m_pDlg->GetDlgItem(IDD_MYWINDOW);
a->SetWindowText("some text");
Where m_pDlg is a pointer at my dialog class
The error is "Memory could not be read "
what's IDD_MYWINDOW? Your dialog ID?
m_pDlg->SetWindowText("some text");
Yes.
I have used this code because for other controls(static texts,buttons etc),it works and I manage to set caption.