GDI(Graphics Device Interface)

DC(Device Context)

Application -----> DC -----> GDI
// 화면 DC에 관련된 함수
BeginPaint(), EndPaint() // BeginPaint를 썼으면 반드시 EndPaint를 써줘야 하고
GetDC(), ReleaseDC()     // GetDC를 썼으면 반드시 ReleaseDC를 써줘야 함.

BeginPain()와 EndPaint()

HDC BeginPaint(
  [in]  HWND          hWnd,    // 다시 그려줄 윈도우에 대한 핸들.
  [out] LPPAINTSTRUCT lpPaint  // 페인팅 정보를 받을 PAINTSTURCT에 대한 포인터.
);
BOOL EndPaint(
  [in] HWND              hWnd,
  [in] const PAINTSTRUCT *lpPaint
);

GetDC()와 ReleaseDC()

HDC GetDC(
  [in] HWND hWnd
);
int ReleaseDC(
  [in] HWND hWnd,
  [in] HDC  hDC
);

TextOut()

BOOL TextOutW(
  [in] HDC     hdc,
  [in] int     x,  // x, y 좌표(좌상단 0,0 기준.)
  [in] int     y,
  [in] LPCWSTR lpString,
  [in] int     c   // 문자열의 길이.
);
// 문자열 넘겨줄 때 sprintf를 사용해 숫자를 포함한 문자열을 구성해서 넘겨줄 수 있음.
#include <tchar.h>   // TEXT 매크로 사용을 위한 헤더
#include <strsafe.h> // StringCbPrintf 사용을 위한 헤더

case WM_PAINT:
        {
            TCHAR text[1024];
            hdc = BeginPaint(hWnd, &ps);
            StringCbPrintf(text, 1024 * sizeof(TCHAR), TEXT("%d %.1f %s"),10, 20.f, L"테스트"); // ms에서 권장하는 sprintf 대체 함수.
            TextOut(hdc, 0, 0, text, lstrlenW(text));
            EndPaint(hWnd, &ps);
            break;
        }
        break;

참고 : https://m.blog.naver.com/PostView.naver?isHttpsRedirect=true&blogId=omram4u&logNo=220720945314

색상 관련 매크로 함수

COLORREF RGB(
		BYTE byRed,
		BYTE byGreen,
		BYTE byBlue
);
// COLORREF는 DWORD 값을 재정의 한 것.