Display text in a Dialog Box
I want to be able to display text in a dialog box based on user input. For example, if I had a button on the main window that displayed a dialog box with customer information. This information would change based on the customer name that the user enters so I can't hard code it in the dialog resorce templete. I've used this meathod in the WndProc to display text on the main window but when I put it in the DlgProc it does not do anything, no text or errors.
Code:
case WM_PAINT:
{
RECT rect;
HDC hdc;
PAINTSTRUCT ps;
if (!(hdc = BeginPaint(hWnd, &ps) ) )
MessageBox(hWnd, "BeginPaint() failed", "error", NULL);
SetTextColor(hdc, RGB(0, 0, 0) );
SetBkColor(hdc, RGB(245, 245, 245) );
GetClientRect(hWnd, &rect);
if (!TextOut(hdc, 45, 45, "this is a test", 14) )
MessageBox(hWnd, "TextOut() failed", "error", NULL);
EndPaint(hWnd, &ps);
}
break;
How else can I display text to a dialog box?