
Untitled
By: a guest on
Jul 10th, 2012 | syntax:
None | size: 0.98 KB | hits: 11 | expires: Never
//just know that it holds information for painting things
PAINTSTRUCT ps;
/* BeginPaint(handle to the window, this will tell begin paint
where to paint to, paint sturct, we pass the reference to it
so we edit the actual variable here, begin paint will just
fill in some information for the ps structure); */
/* HDC is a handle to a device contex (DC).
A DC is basically just an object in Win32 that allows us to use graphics */
HDC hDC = BeginPaint (hWnd, &ps);
//Sets the text color
SetTextColor (hDC, RGB (60, 60, 0));
//Bakcground color of text
SetBkColor(hDC, (COLORREF)(COLOR_WINDOW+1));
char *cpText = "Hello World!";
//Handle to the font
HFONT hfFont;
SelectObject (hDC, hfFont);
CreateFont (20, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, L"Times New Roman");
// so that will print the text
TextOutA (hDC, 5, 5, (LPCSTR)cpText, strlen (cpText));
//Ends the paint
EndPaint (hWnd, &ps);
DeleteObject (hfFont);