Use TextOut() in WM_COMMAND
问题 I'm trying to print a text in the WM_COMMAND case, because I need a text to be printed after a button was pushed. Here's the code I have: switch(msg) { default: return DefWindowProc(hwnd, msg, wParam, lParam); case WM_COMMAND: switch (LOWORD(wParam)) { case 1: PAINTSTRUCT ps; HDC hDC; hDC = BeginPaint(hwnd, &ps); { TextOut(hDC, 10, 50, "hello", 5); } EndPaint(hwnd, &ps); UpdateWindow(hwnd); break; } break; } Sadly it doesn't print anything. edit: I can use TextOut() during WM_COMMAND that way