标签:wpa pcm tst def print dispatch otl param class
#include <Windows.h> #include <tchar.h> TCHAR szColor[32][30] = { _T("- - -"), _T("COLOR_SCROLLBAR"), _T("COLOR_BACKGROUND"), _T("COLOR_ACTIVECAPTION"), _T("COLOR_INACTIVECAPTION"), _T("COLOR_MENU"), _T("COLOR_WINDOW"), _T("COLOR_WINDOWFRAME"), _T("COLOR_MENUTEXT"), _T("COLOR_WINDOWTEXT"), _T("COLOR_CAPTIONTEXT"), _T("COLOR_ACTIVEBORDER"), _T("COLOR_INACTIVEBORDER"), _T("COLOR_APPWORKSPACE"), _T("COLOR_HIGHLIGHT"), _T("COLOR_HIGHLIGHTTEXT"), _T("COLOR_BTNFACE"), _T("COLOR_BTNSHADOW"), _T("COLOR_GRAYTEXT"), _T("COLOR_BTNTEXT"), _T("COLOR_INACTIVECAPTIONTEXT"), _T("COLOR_BTNHIGHLIGHT"), _T("COLOR_3DDKSHADOW"), _T("COLOR_3DLIGHT"), _T("COLOR_INFOTEXT"), _T("COLOR_INFOBK"), _T("- - -"), _T("COLOR_HOTLIGHT"), _T("COLOR_GRADIENTACTIVECAPTION"), _T("COLOR_GRADIENTINACTIVECAPTION"), _T("COLOR_MENUHILIGHT"), _T("COLOR_MENUBAR") }; LRESULT CALLBACK WndProc(HWND, UINT, WPARAM, LPARAM); void OnPaint(HWND); int APIENTRY _tWinMain(HINSTANCE hInst, HINSTANCE hPrevInst, LPTSTR lpCmdLine, int nCmdShow) { MSG msg; WNDCLASSEX wcex; HWND hWnd; wcex.cbClsExtra = 0; wcex.cbSize = sizeof(WNDCLASSEX); wcex.cbWndExtra = 0; wcex.hbrBackground = (HBRUSH)(COLOR_BTNFACE + 1); wcex.hCursor = LoadCursor(NULL, IDC_ARROW); wcex.hIcon = NULL; wcex.hIconSm = NULL; wcex.hInstance = hInst; wcex.lpfnWndProc = WndProc; wcex.lpszClassName = _T("Wnd"); wcex.lpszMenuName = NULL; wcex.style = CS_VREDRAW | CS_HREDRAW; if (!RegisterClassEx(&wcex)) { MessageBox(NULL, _T("RegisterClassEx()"), NULL, MB_ICONERROR); return 0; } hWnd = CreateWindowEx(0, _T("Wnd"), _T("Colors"), WS_OVERLAPPEDWINDOW | WS_VISIBLE, CW_USEDEFAULT, CW_USEDEFAULT, CW_USEDEFAULT, CW_USEDEFAULT, NULL, NULL, hInst, NULL); if (!hWnd) { MessageBox(NULL, _T("CreateWindowEx()"), NULL, MB_ICONERROR); return 0; } while (GetMessage(&msg, NULL, 0, 0)) { TranslateMessage(&msg); DispatchMessage(&msg); } return 0; } LRESULT CALLBACK WndProc(HWND hWnd, UINT uMsg, WPARAM wParam, LPARAM lParam) { switch (uMsg) { case WM_PAINT: OnPaint(hWnd); break; case WM_DESTROY: PostQuitMessage(0); break; default: return DefWindowProc(hWnd, uMsg, wParam, lParam); } return 0; } void OnPaint(HWND hWnd) { HDC hdc; PAINTSTRUCT pt; RECT rc; int i, j; TCHAR sz[40]; hdc = BeginPaint(hWnd, &pt); if (hdc) { for (i=0; i< 32; i++) { if (i%4 == 0) { j = i / 4; rc.left = 0; rc.top = j * 60; rc.bottom = rc.top + 60; } else { rc.left = rc.right; } rc.right = rc.left + 168; FillRect(hdc, &rc, (HBRUSH)(i)); wsprintf(sz, L"(%d)%s", i, szColor[i]); DrawText(hdc, sz, lstrlen(sz), &rc, DT_WORDBREAK | DT_EDITCONTROL); } EndPaint(hWnd, &pt); } }
标签:wpa pcm tst def print dispatch otl param class
原文地址:https://www.cnblogs.com/qbj196/p/10635261.html