Skip to main content
gamedev.net
🔒 Locked

Simple GDI help

Started by julienX Jan 15, 2003 at 9:04 AM 1 replies 500+ views
Original Post
julienX
julienX
I am wondering why my code doesn''t work, I am trying to print text to the screen. Here''s the main loop from WinMain:
   
    hdc = GetDC(hwnd);
    
    //Message loop

    while (TRUE)
    {
        if (PeekMessage(&msg,NULL,0,0,PM_REMOVE))
        {
             if (msg.message == WM_QUIT)
             break;
             
             TranslateMessage(&msg);
             DispatchMessage(&msg);
        } //End if

        
        SetTextColor(hdc,RGB(256,0,0));
        SetBkColor(hdc,RGB(0,0,0));
        SetBkMode(hdc,TRANSPARENT);
        
        TextOut(hdc,0,0,"Hello",strlen("Hello"));
    }
    
    ReleaseDC(hwnd,hdc);
    return (msg.wParam);
} //End WinMain


  
I''ve checked the code from my book(TOTWGPG) and mine matches it perfectly, please help! (i bet its something to do with my colors!)
chacha
Brandisco
Brandisco
Change this line:

SetTextColor(hdc,RGB(256,0,0));


To:

SetTextColor(hdc,RGB(255,0,0));
julienX
julienX
Oh what a stupid mistake!
Thanks for pointing it out to me Brandisco
chacha

Topic Locked

This topic has been locked by a moderator. New replies are not allowed.

Sign in to reply to this topic.