Thread: TextOut() Questions

  1. #1
    Dipset
    Guest

    TextOut() Questions

    1 - Can the font on TextOut() be changed from the default font which is "System"?

    2 - I read that you have to free GDI resources when finished using TextOut(). Do you have to call EndPaint() right after you're done painting text or is OK to do it the way I have it here:

    Code:
    case WM_CLOSE:
                            DestroyWindow(hwnd);
    						 EndPaint(hwnd, &ps);
    					    break;
                    case WM_DESTROY:
                            PostQuitMessage(0);
    						 EndPaint(hwnd, &ps);
                            break;
    Thanks.

  2. #2
    Registered User
    Join Date
    Jun 2003
    Posts
    70

    >1 - Can the font on TextOut() be changed from the default font which is "System"?


    Ya...you can do it using SelectObject() function of Device Context(HDC or CDC).


    >2 - I read that you have to free GDI resources when finished using TextOut(). Do you have to call EndPaint() right after you're done painting text or is OK to do it the way I have it here:


    GDI resource means object of type ... HFONT, HBITMAP, HRGN and so on....

    If you use these objects during painting, then you have to use DeleteObject() function to release these resources. No need to call EndPain().
    Chintan R Naik

  3. #3
    Registered User
    Join Date
    Jun 2003
    Posts
    245
    TextOut will use the currently selected font & color of the device context your writing onto.

    There's no need to free GDI resources directly after TextOut, only when you have finished painting.

Popular pages Recent additions subscribe to a feed

Similar Threads

  1. questions....so many questions about random numbers....
    By face_master in forum C++ Programming
    Replies: 2
    Last Post: 07-30-2009, 08:47 AM
  2. A very long list of questions... maybe to long...
    By Ravens'sWrath in forum C Programming
    Replies: 16
    Last Post: 05-16-2007, 05:36 AM
  3. Several Questions, main one is about protected memory
    By Tron 9000 in forum C Programming
    Replies: 3
    Last Post: 06-02-2005, 07:42 AM
  4. Trivial questions - what to do?
    By Aerie in forum A Brief History of Cprogramming.com
    Replies: 23
    Last Post: 12-26-2004, 09:44 AM
  5. questions questions questions.....
    By mfc2themax in forum A Brief History of Cprogramming.com
    Replies: 1
    Last Post: 08-14-2001, 07:22 AM