// wb_t@CÌCN[h
#include <windows.h>	// WWindowsAPI
#include <tchar.h>		// TCHAR^
#include <string.h>		// C¶ñ

// ÖÌvg^Cvé¾
LRESULT CALLBACK WindowProc(HWND hwnd, UINT uMsg, WPARAM wParam, LPARAM lParam);	// EBhEbZ[WÉÎµÄÆ©Ìð·éæ¤Éè`µ½R[obNÖWindowProc.

// _tWinMainÖÌè`
int WINAPI _tWinMain(HINSTANCE hInstance, HINSTANCE hPrevInstance, LPTSTR lpCmdLine, int nShowCmd) {

	// ÏÌé¾
	HWND hWnd;			// CreateWindowÅì¬µ½EBhEÌEBhEnhði[·éHWND^ÏhWnd.
	MSG msg;			// EBhEbZ[Wîñði[·éMSG\¢Ì^Ïmsg.
	WNDCLASS wc;		// EBhENXîñðàÂWNDCLASS\¢Ì^Ïwc.

	// EBhENXÌÝè
	wc.lpszClassName = _T("SetBkColor");					// EBhENX¼Í"SetBkColor".
	wc.style = CS_HREDRAW | CS_VREDRAW;						// X^CÍCS_HREDRAW | CS_VREDRAW.
	wc.lpfnWndProc = WindowProc;							// EBhEvV[WÍÆ©Ìðè`µ½WindowProc.
	wc.hInstance = hInstance;								// CX^XnhÍ_tWinMainÌø.
	wc.hIcon = LoadIcon(NULL, IDI_APPLICATION);				// ACRÍAvP[VùèÌàÌ.
	wc.hCursor = LoadCursor(NULL, IDC_ARROW);				// J[\Íîó.
	wc.hbrBackground = (HBRUSH)GetStockObject(WHITE_BRUSH);	// wiÍuV.
	wc.lpszMenuName = NULL;									// j[ÍÈµ.
	wc.cbClsExtra = 0;										// 0Å¢¢.
	wc.cbWndExtra = 0;										// 0Å¢¢.

	// EBhENXÌo^
	if (!RegisterClass(&wc)) {	// RegisterClassÅEBhENXðo^µ, 0ªÔÁ½çG[.

		// G[
		MessageBox(NULL, _T("RegisterClass failed!"), _T("SetBkColor"), MB_OK | MB_ICONHAND);	// MessageBoxÅ"RegisterClass failed!"ÆG[bZ[Wð\¦.
		return -1;	// ÙíI¹(1)

	}

	// EBhEÌì¬
	hWnd = CreateWindow(_T("SetBkColor"), _T("SetBkColor"), WS_OVERLAPPEDWINDOW, CW_USEDEFAULT, CW_USEDEFAULT, CW_USEDEFAULT, CW_USEDEFAULT, NULL, NULL, hInstance, NULL);	// CreateWindowÅ, ãÅo^µ½"SetBkColor"EBhENXÌEBhEðì¬.
	if (hWnd == NULL) {	// EBhEÌì¬É¸sµ½Æ«.

		// G[
		MessageBox(NULL, _T("CreateWindow failed!"), _T("SetBkColor"), MB_OK | MB_ICONHAND);	// MessageBoxÅ"CreateWindow failed!"ÆG[bZ[Wð\¦.
		return -2;	// ÙíI¹(2)

	}

	// EBhEÌ\¦
	ShowWindow(hWnd, SW_SHOW);	// ShowWindowÅSW_SHOWðwèµÄEBhEÌ\¦.

	// bZ[W[v
	while (GetMessage(&msg, NULL, 0, 0) > 0) {	// GetMessageÅbZ[Wðæ¾, ßèlª0æèå«¢ÔÍ[vµ±¯é.

		// EBhEbZ[WÌo
		DispatchMessage(&msg);	// DispatchMessageÅó¯æÁ½bZ[WðEBhEvV[W(±ÌêÍÆ©Éè`µ½WindowProc)Éo.

	}

	// vOÌI¹
	return (int)msg.wParam;	// I¹R[h(msg.wParam)ðßèlÆµÄÔ·.

}

// WindowProcÖÌè`
LRESULT CALLBACK WindowProc(HWND hwnd, UINT uMsg, WPARAM wParam, LPARAM lParam) {	// EBhEbZ[WÉÎµÄÆ©Ìð·éæ¤Éè`µ½EBhEvV[W.

	// EBhEbZ[WÉÎ·é.
	switch (uMsg) {	// switch-casa¶ÅuMsgÌl²ÆÉðUèª¯é.

		// EBhEÌì¬ªJn³ê½.
		case WM_CREATE:		// EBhEÌì¬ªJn³ê½.(uMsgªWM_CREATEÌ.)

			// WM_CREATEubN
			{

				// EBhEì¬¬÷
				return 0;	// return¶Å0ðÔµÄ, EBhEì¬¬÷Æ·é.

			}

			// ùèÌÖü©¤.
			break;	// breakÅ²¯Ä, ùèÌ(DefWindowProc)Öü©¤.

		// EBhEªjü³ê½.
		case WM_DESTROY:	// EBhEªjü³ê½.(uMsgªWM_DESTROYÌ.)

			// WM_DESTROYubN
			{

				// I¹bZ[WÌM.
				PostQuitMessage(0);	// PostQuitMessageÅI¹R[hð0ÆµÄWM_QUITbZ[WðM.(·éÆbZ[W[vÌGetMessageÌßèlª0ÉÈéÌÅ, bZ[W[v©ç²¯é.)

			}

			// ùèÌÖü©¤.
			break;	// breakÅ²¯Ä, ùèÌ(DefWindowProc)Öü©¤.

		// æÊÌ`æðv³ê½.
		case WM_PAINT:		// æÊÌ`æðv³ê½.(uMsgªWM_PAINTÌ.)

			// WM_PAINTubN
			{

				// ±ÌubNÌ[JÏEzñÌé¾Æú».
				HDC hDC;		// foCXReLXgnhði[·éHDC^ÏhDC.
				PAINTSTRUCT ps;	// yCgîñðÇ·éPAINTSTRUCT\¢Ì^ÌÏps.
				TCHAR tszText[] = _T("ABCDE");	// TCHAR^zñtszTextð"ABCDE"Åú».
				size_t uiLen = 0;	// tszTextÌ·³ði[·é½ßÌsize_t^ÏuiLenð0Éú».

				// EBhEÌ`æJn
				hDC = BeginPaint(hwnd, &ps);	// BeginPaintÅ±ÌEBhEÌ`æÌõð·é. ßèlÉÍfoCXReLXgnhªÔéÌÅ, hDCÉi[.

				// wiFÌÝè
				SetBkColor(hDC, RGB(0x00, 0x00, 0xff));	// SetBkColorÅÂðZbg.

				// `æFÌÝè
				SetTextColor(hDC, RGB(0xff, 0x00, 0x00));	// SetTextColorÅÔðZbg.

				// ¶ñÌ`æ
				uiLen = _tcslen(tszText);	// _tcslenÅtszTextÌ·³ðæ¾µ, uiLenÉi[.
				TextOut(hDC, 50, 50, tszText, (int)uiLen);	// TextOutÅEBhEhwndÌÀW(50, 50)ÌÊuÉtszTextð`æ.

				// EBhEÌ`æI¹
				EndPaint(hwnd, &ps);	// EndPaintÅ±ÌEBhEÌ`æðI¹·é.

			}

			// ùèÌÖü©¤.
			break;	// breakÅ²¯Ä, ùèÌ(DefWindowProc)Öü©¤.

		// ãLÈOÌ.
		default:	// ãLÈOÌlÌÌùè.

			// ùèÌÖü©¤.
			break;	// breakÅ²¯Ä, ùèÌ(DefWindowProc)Öü©¤.

	}

	//  ÆÍùèÌÉC¹é.
	return DefWindowProc(hwnd, uMsg, wParam, lParam);	// ßèlàÜßDefWindowProcÉùèÌðC¹é.

}