Don't like ads? PRO users don't see any ads ;-)
Guest

Untitled

By: a guest on Jul 10th, 2012  |  syntax: None  |  size: 0.98 KB  |  hits: 11  |  expires: Never
download  |  raw  |  embed  |  report abuse  |  print
Text below is selected. Please press Ctrl+C to copy to your clipboard. (⌘+C on Mac)
  1. //just know that it holds information for painting things
  2.                         PAINTSTRUCT ps;
  3.                         /* BeginPaint(handle to the window, this will tell begin paint
  4.                         where to paint to, paint sturct, we pass the reference to it
  5.                         so we edit the actual variable here, begin paint will just
  6.                         fill in some information for the ps structure); */
  7.                         /*     HDC is a handle to a device contex (DC).
  8.                         A DC is basically just an object in Win32 that allows us to use graphics */
  9.                     HDC hDC = BeginPaint (hWnd, &ps);
  10.                         //Sets the text color
  11.                         SetTextColor (hDC, RGB (60, 60, 0));
  12.                         //Bakcground color of text
  13.                         SetBkColor(hDC, (COLORREF)(COLOR_WINDOW+1));
  14.                         char *cpText = "Hello World!";
  15.                         //Handle to the font
  16.                         HFONT hfFont;
  17.                         SelectObject (hDC, hfFont);
  18.                         CreateFont (20, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, L"Times New Roman");
  19.                         // so that will print the text
  20.                         TextOutA (hDC, 5, 5, (LPCSTR)cpText, strlen (cpText));
  21.                         //Ends the paint
  22.                         EndPaint (hWnd, &ps);
  23.                         DeleteObject (hfFont);