LRESULT CALLBACK WndProc(HWND hwnd, UINT message, WPARAM wParam, LPARAM lParam)
{
HDC hdc;
PAINTSTRUCT ps;
TCHAR szBuffer[1];
switch (message)
{
case WM_CHAR:
szBuffer[1] = (TCHAR) wParam;
cout << wParam << " " << szBuffer[1] << " ";
break;
case WM_PAINT:
InvalidateRect(hwnd, NULL, TRUE);
hdc = BeginPaint(hwnd, &ps);
SelectObject(hdc,GetStockObject(SYSTEM_FIXED_FONT));
TextOut(hdc, 1, 1, szBuffer, 1);
EndPaint(hwnd, &ps);
return 0;
Hello all, I am trying to run the above code and simply print a single letter at a time on my window. However, I cannot seem to get the characters to appear on the window with the TextOut function but am able to display the characters in the terminal window. I am new to WinApi and am lost!
thanks in advance!