Tips on Using TextOut Function

Orlando Gondar 61 Reputation points
2022-07-29T11:55:09.05+00:00

Hello there.....
Is there a way for the TextOut function to display ASCII Characters?
Also Hexdecimal Numbers?

Thanks.

Windows development Windows API - Win32
{count} votes

2 answers

Sort by: Most helpful
  1. Castorix31 90,681 Reputation points
    2022-07-30T13:54:56.663+00:00

    You can just format the text :

                    HDC hDC = GetDC(NULL);  
                    SetTextColor(hDC, RGB(255, 0, 0));  
                    WCHAR wsText[255] = L"";  
                    wsprintf(wsText, L"Test ASCII : %c", 169);                      
                    TextOut(hDC, 800, 200, wsText, lstrlen(wsText));  
                    wsprintf(wsText, L"Test Hexa : %08X", 169);  
                    TextOut(hDC, 800, 230, wsText, lstrlen(wsText));  
                    ReleaseDC(NULL, hDC);  
    

    226404-textout.jpg

    0 comments No comments

  2. Orlando Gondar 61 Reputation points
    2022-07-30T14:36:25.903+00:00

    Thanks a million!!


Your answer

Answers can be marked as Accepted Answers by the question author, which helps users to know the answer solved the author's problem.