-
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.
-
>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().
-
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.