Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #include "stdafx.h"
- //DIGLOCK
- //#include<Windows.h>
- //
- //#define ID_TIMER 1
- //
- //LRESULT CALLBACK WndProc(HWND, UINT, WPARAM, LPARAM);
- //
- //int WINAPI WinMain(HINSTANCE hInstance, HINSTANCE hPrevInstance, PSTR szCmdLine, int iCmdShow)
- //{
- // static TCHAR szAppName[] = TEXT("DigClock");
- // HWND hwnd;
- // MSG msg;
- // WNDCLASS wndclass;
- //
- // wndclass.style = CS_HREDRAW | CS_VREDRAW;
- // wndclass.lpfnWndProc = WndProc;
- // wndclass.cbClsExtra = 0;
- // wndclass.cbWndExtra = 0;
- // wndclass.hInstance = hInstance;
- // wndclass.hIcon = LoadIcon(NULL, IDI_APPLICATION);
- // wndclass.hCursor = LoadCursor(NULL, IDC_ARROW);
- // wndclass.hbrBackground = (HBRUSH)GetStockObject(WHITE_BRUSH);
- // wndclass.lpszMenuName = NULL;
- // wndclass.lpszClassName = szAppName;
- //
- // if (!RegisterClass(&wndclass))
- // {
- // MessageBox(NULL, TEXT("Program requires Windows NT!"), szAppName, MB_ICONERROR);
- // return 0;
- // }
- //
- // hwnd = CreateWindow(szAppName, TEXT("DigitalClock"), WS_OVERLAPPEDWINDOW, CW_USEDEFAULT, CW_USEDEFAULT, CW_USEDEFAULT, CW_USEDEFAULT, NULL, NULL, hInstance, NULL);
- // ShowWindow(hwnd, iCmdShow);
- // UpdateWindow(hwnd);
- //
- // while (GetMessage(&msg, NULL, 0, 0))
- // {
- // TranslateMessage(&msg);
- // DispatchMessage(&msg);
- // }
- //
- // return msg.wParam;
- //
- //}
- //
- //void DisplayDigit(HDC hdc, int iNumber)
- //{
- // static BOOL fSeventSegment[10][7] = {
- // 1, 1, 1, 0, 1, 1, 1, // 0
- // 0, 0, 1, 0, 0, 1, 0, // 1
- // 1, 0, 1, 1, 1, 0, 1, // 2
- // 1, 0, 1, 1, 0, 1, 1, // 3
- // 0, 1, 1, 1, 0, 1, 0, // 4
- // 1, 1, 0, 1, 0, 1, 1, // 5
- // 1, 1, 0, 1, 1, 1, 1, // 6
- // 1, 0, 1, 0, 0, 1, 0, // 7
- // 1, 1, 1, 1, 1, 1, 1, // 8
- // 1, 1, 1, 1, 0, 1, 1 }; // 9
- //
- // static POINT ptSegment[7][6] = {
- // 7, 6, 11, 2, 31, 2, 35, 6, 31, 10, 11, 10,
- // 6, 7, 10, 11, 10, 31, 6, 35, 2, 31, 2, 11,
- // 36, 7, 40, 11, 40, 31, 36, 35, 32, 31, 32, 11,
- // 7, 36, 11, 32, 31, 32, 35, 36, 31, 40, 11, 40,
- // 6, 37, 10, 41, 10, 61, 6, 65, 2, 61, 2, 41,
- // 36, 37, 40, 41, 40, 61, 36, 65, 32, 61, 32, 41,
- // 7, 66, 11, 62, 31, 62, 35, 66, 31, 70, 11, 70 };
- //
- // int iSeg;
- //
- // for (iSeg = 0; iSeg < 7; iSeg++)
- // if (fSeventSegment[iNumber][iSeg])
- // Polygon(hdc, ptSegment[iSeg], 6);
- //}
- //
- //void DisplayTwoDigits(HDC hdc, int iNumber, BOOL fSuppress)
- //{
- // if (!fSuppress || (iNumber / 10 != 0)) DisplayDigit(hdc, iNumber / 10);
- // OffsetWindowOrgEx(hdc, -42, 0, NULL);
- // DisplayDigit(hdc, iNumber % 10);
- // OffsetWindowOrgEx(hdc, -42, 0, NULL);
- //
- //}
- //
- //void DisplayColon(HDC hdc)
- //{
- // POINT ptColon[2][4] = { 2, 21, 6, 17, 10, 21, 6, 25,
- // 2, 51, 6, 47, 10, 51, 6, 55 };
- //
- // Polygon(hdc, ptColon[0], 4);
- // Polygon(hdc, ptColon[1], 4);
- // OffsetWindowOrgEx(hdc, -12, 0, NULL);
- //
- //}
- //
- //void DisplayTime(HDC hdc, BOOL f24Hour, BOOL fSuppress)
- //{
- // SYSTEMTIME st;
- // GetLocalTime(&st);
- // if (f24Hour) DisplayTwoDigits(hdc, st.wHour, fSuppress);
- // else DisplayTwoDigits(hdc, (st.wHour %= 12) ? st.wHour : 12, fSuppress);
- // DisplayColon(hdc);
- // DisplayTwoDigits(hdc, st.wMinute, FALSE);
- // DisplayColon(hdc);
- // DisplayTwoDigits(hdc, st.wSecond, FALSE);
- //
- //}
- //
- //LRESULT CALLBACK WndProc(HWND hwnd, UINT message, WPARAM wParam, LPARAM lParam)
- //{
- // static BOOL f24Hour, fSuppress;
- // static HBRUSH hBrushRed;
- // static int cxClient, cyClient;
- // HDC hdc;
- // PAINTSTRUCT ps;
- // TCHAR szBuffer[2];
- //
- // switch (message)
- // {
- // case WM_CREATE:
- // hBrushRed = CreateSolidBrush(RGB(255, 0, 0));
- // SetTimer(hwnd, ID_TIMER, 1000, NULL);
- //
- // case WM_SETTINGCHANGE:
- // GetLocaleInfo(LOCALE_USER_DEFAULT, LOCALE_ITIME, szBuffer, 2);
- // f24Hour = (szBuffer[0] == '1');
- // GetLocaleInfo(LOCALE_USER_DEFAULT, LOCALE_ITLZERO, szBuffer, 2);
- // fSuppress = (szBuffer[0] == '0');
- // InvalidateRect(hwnd, NULL, TRUE);
- // return 0;
- //
- // case WM_SIZE:
- // cxClient = LOWORD(lParam);
- // cyClient = HIWORD(lParam);
- // return 0;
- //
- // case WM_TIMER:
- // InvalidateRect(hwnd, NULL, TRUE);
- // return 0;
- //
- // case WM_PAINT:
- // hdc = BeginPaint(hwnd, &ps);
- // SetMapMode(hdc, MM_ISOTROPIC);
- // SetWindowExtEx(hdc, 276, 72, NULL);
- // SetViewportExtEx(hdc, cxClient, cyClient, NULL);
- //
- // SetWindowOrgEx(hdc, 138, 36, NULL);
- // SetViewportOrgEx(hdc, cxClient / 2, cyClient / 2, NULL);
- // SelectObject(hdc, GetStockObject(NULL_PEN));
- // SelectObject(hdc, hBrushRed);
- //
- // DisplayTime(hdc, f24Hour, fSuppress);
- // EndPaint(hwnd, &ps);
- // return 0;
- //
- // case WM_DESTROY:
- // KillTimer(hwnd, ID_TIMER);
- // DeleteObject(hBrushRed);
- // PostQuitMessage(0);
- // return 0;
- //
- // }
- //
- // return DefWindowProc(hwnd, message, wParam, lParam);
- //
- //}
- //BEEPER2
- //#include<Windows.h>
- //
- //#define ID_TIMER 1
- //
- //LRESULT CALLBACK WndProc(HWND, UINT, WPARAM, LPARAM);
- //VOID CALLBACK TimerProc(HWND, UINT, UINT, DWORD);
- //
- //int WINAPI WinMain(HINSTANCE hInstance, HINSTANCE hPrevInstance, PSTR szCmdLine, int iCmdShow)
- //{
- // static TCHAR szAppName[] = TEXT("Beeper2");
- // HWND hwnd;
- // MSG msg;
- // WNDCLASS wndclass;
- //
- // wndclass.style = CS_HREDRAW | CS_VREDRAW;
- // wndclass.lpfnWndProc = WndProc;
- // wndclass.cbClsExtra = 0;
- // wndclass.cbWndExtra = 0;
- // wndclass.hInstance = hInstance;
- // wndclass.hIcon = LoadIcon(NULL, IDI_APPLICATION);
- // wndclass.hCursor = LoadCursor(NULL, IDC_ARROW);
- // wndclass.hbrBackground = (HBRUSH)GetStockObject(WHITE_BRUSH);
- // wndclass.lpszMenuName = NULL;
- // wndclass.lpszClassName = szAppName;
- //
- // if (!RegisterClass(&wndclass))
- // {
- // MessageBox(NULL, TEXT("Program requires Windows NT!"), szAppName, MB_ICONERROR);
- // return 0;
- // }
- //
- // hwnd = CreateWindow(szAppName, TEXT("Beeper1 Timer Demo"), WS_OVERLAPPEDWINDOW, CW_USEDEFAULT, CW_USEDEFAULT, CW_USEDEFAULT, CW_USEDEFAULT, NULL, NULL, hInstance, NULL);
- // ShowWindow(hwnd, iCmdShow);
- // UpdateWindow(hwnd);
- // while (GetMessage(&msg, NULL, 0, 0))
- // {
- // TranslateMessage(&msg);
- // DispatchMessage(&msg);
- // }
- // return msg.wParam;
- //
- //}
- //
- //LRESULT CALLBACK WndProc(HWND hwnd, UINT message, WPARAM wParam, LPARAM lParam)
- //{
- // switch (message)
- // {
- // case WM_CREATE:
- // SetTimer(hwnd, ID_TIMER, 1000, TimerProc);
- // return 0;
- //
- // case WM_DESTROY:
- // KillTimer(hwnd, ID_TIMER);
- // PostQuitMessage(0);
- // return 0;
- // }
- // return DefWindowProc(hwnd, message, wParam, lParam);
- //
- //}
- //
- //
- //VOID CALLBACK TimerProc(HWND hwnd, UINT message, UINT iTimerID, DWORD dwTime)
- //{
- // static BOOL fFlipFlop = FALSE;
- // HBRUSH hBrush;
- // HDC hdc;
- // RECT rc;
- //
- // MessageBeep(-1);
- // fFlipFlop = !fFlipFlop;
- // GetClientRect(hwnd, &rc);
- //
- // hdc = GetDC(hwnd);
- // hBrush = CreateSolidBrush(fFlipFlop ? RGB(255, 0, 0) : RGB(0, 0, 255));
- //
- // FillRect(hdc, &rc, hBrush);
- // ReleaseDC(hwnd, hdc);
- // DeleteObject(hBrush);
- //
- //}
- //BEEPER1
- //#include<Windows.h>
- //#define ID_TIMER 1
- //
- //LRESULT CALLBACK WndProc(HWND, UINT, WPARAM, LPARAM);
- //
- //int WINAPI WinMain(HINSTANCE hInstance, HINSTANCE hPrevInstance, PSTR szCmdLine, int iCmdShow)
- //{
- // static TCHAR szAppName[] = TEXT("Beeper1");
- // HWND hwnd;
- // MSG msg;
- // WNDCLASS wndclass;
- //
- // wndclass.style = CS_HREDRAW || CS_VREDRAW;
- // wndclass.lpfnWndProc = WndProc;
- // wndclass.cbClsExtra = 0;
- // wndclass.cbWndExtra = 0;
- // wndclass.hInstance = hInstance;
- // wndclass.hIcon = LoadIcon(NULL, IDI_APPLICATION);
- // wndclass.hCursor = LoadCursor(NULL, IDC_ARROW);
- // wndclass.hbrBackground = (HBRUSH)GetStockObject(WHITE_BRUSH);
- // wndclass.lpszMenuName = NULL;
- // wndclass.lpszClassName = szAppName;
- //
- // if (!RegisterClass(&wndclass))
- // {
- // MessageBox(NULL, TEXT("Program requires Windows NT!"), szAppName, MB_ICONERROR);
- // return 0;
- // }
- //
- // hwnd = CreateWindow(szAppName, TEXT("Beeper1 Timer Demo"), WS_OVERLAPPEDWINDOW, CW_USEDEFAULT, CW_USEDEFAULT, CW_USEDEFAULT, CW_USEDEFAULT, NULL, NULL, hInstance, NULL);
- // ShowWindow(hwnd, iCmdShow);
- // UpdateWindow(hwnd);
- // while (GetMessage(&msg, NULL, 0, 0))
- // {
- // TranslateMessage(&msg);
- // DispatchMessage(&msg);
- // }
- // return msg.wParam;
- //
- //}
- //
- //LRESULT CALLBACK WndProc(HWND hwnd, UINT message, WPARAM wParam, LPARAM lParam)
- //{
- // static BOOL fFlipFlop = FALSE;
- // HBRUSH hBrush;
- // HDC hdc;
- // PAINTSTRUCT ps;
- // RECT rc;
- //
- // switch (message)
- // {
- // case WM_CREATE:
- // SetTimer(hwnd, ID_TIMER, 1000, NULL);
- // return 0;
- //
- // case WM_TIMER:
- // MessageBeep(-1);
- // fFlipFlop = !fFlipFlop;
- // InvalidateRect(hwnd, NULL, FALSE);
- // return 0;
- //
- // case WM_PAINT:
- // hdc = BeginPaint(hwnd, &ps);
- // GetClientRect(hwnd, &rc);
- // hBrush = CreateSolidBrush(fFlipFlop ? RGB(255, 0, 0) : RGB(0, 0, 255));
- // FillRect(hdc, &rc, hBrush);
- // EndPaint(hwnd, &ps);
- // DeleteObject(hBrush);
- // return 0;
- //
- // case WM_DESTROY:
- // KillTimer(hwnd, ID_TIMER);
- // PostQuitMessage(0);
- // return 0;
- // }
- //
- // return DefWindowProc(hwnd, message, wParam, lParam);
- //
- //}
- //SYSMETS
- //#include<Windows.h>
- //#include "sysmets.h"
- //
- //LRESULT CALLBACK WndProc(HWND, UINT, WPARAM, LPARAM);
- //
- //int WINAPI WinMain(HINSTANCE hInstance, HINSTANCE hPrevInstance, PSTR szCmdLine, int iCmdShow)
- //{
- // static TCHAR szAppName[] = TEXT("SysMets");
- // HWND hwnd;
- // MSG msg;
- // WNDCLASS wndclass;
- // wndclass.style = CS_HREDRAW | CS_VREDRAW;
- // wndclass.lpfnWndProc = WndProc;
- // wndclass.cbClsExtra = 0;
- // wndclass.cbWndExtra = 0;
- // wndclass.hInstance = hInstance;
- // wndclass.hIcon = LoadIcon(NULL, IDI_APPLICATION);
- // wndclass.hCursor = LoadCursor(NULL, IDC_ARROW);
- // wndclass.hbrBackground = (HBRUSH)GetStockObject(WHITE_BRUSH);
- // wndclass.lpszMenuName = NULL;
- // wndclass.lpszClassName = szAppName;
- //
- // if (!RegisterClass(&wndclass))
- // {
- // MessageBox(NULL, TEXT("Program requires Windows NT!"),
- // szAppName, MB_ICONERROR);
- // return 0;
- // }
- // hwnd = CreateWindow(szAppName, TEXT("Get System Metrics"),
- // WS_OVERLAPPEDWINDOW | WS_VSCROLL | WS_HSCROLL,
- // CW_USEDEFAULT, CW_USEDEFAULT,
- // CW_USEDEFAULT, CW_USEDEFAULT,
- // NULL, NULL, hInstance, NULL);
- //
- // ShowWindow(hwnd, iCmdShow);
- // UpdateWindow(hwnd);
- // while (GetMessage(&msg, NULL, 0, 0))
- // {
- // TranslateMessage(&msg);
- // DispatchMessage(&msg);
- // }
- // return msg.wParam;
- //}
- //
- //LRESULT CALLBACK WndProc(HWND hwnd, UINT message, WPARAM wParam, LPARAM lParam)
- //{
- // static int cxChar, cxCaps, cyChar, cxClient, cyClient, iMaxWidth;
- // static int iDeltaPerLine, iAccumDelta;
- // int i, x, y, iVertPos, iHorzPos, iPaintBeg, iPaintEnd;
- // HDC hdc;
- // PAINTSTRUCT ps;
- // SCROLLINFO si;
- // TCHAR szBuffer[10];
- // TEXTMETRIC tm;
- // ULONG ulScrollLines;
- //
- // switch (message)
- // {
- // case WM_CREATE:
- // hdc = GetDC(hwnd);
- // GetTextMetrics(hdc, &tm);
- // cxChar = tm.tmAveCharWidth;
- // cxCaps = (tm.tmPitchAndFamily & 1 ? 3 : 2)*cxChar / 2;
- // cyChar = tm.tmHeight + tm.tmExternalLeading;
- //
- // ReleaseDC(hwnd, hdc);
- // iMaxWidth = 40 * cxChar + 22 * cxCaps;
- //
- // case WM_SETTINGCHANGE:
- // SystemParametersInfo(SPI_GETWHEELSCROLLLINES, 0, &ulScrollLines, 0);
- // if (ulScrollLines) iDeltaPerLine = WHEEL_DELTA / ulScrollLines;
- // else iDeltaPerLine = 0;
- // return 0;
- //
- // case WM_SIZE:
- // cxClient = LOWORD(lParam);
- // cyClient = HIWORD(lParam);
- //
- // si.cbSize = sizeof(si);
- // si.fMask = SIF_RANGE | SIF_PAGE;
- // si.nMin = 0;
- // si.nMax = NUMLINES - 1;
- // si.nPage = cyClient / cyChar;
- // SetScrollInfo(hwnd, SB_VERT, &si, TRUE);
- //
- // si.cbSize = sizeof(si);
- // si.fMask = SIF_RANGE | SIF_PAGE;
- // si.nMin = 0;
- // si.nMax = 2 + iMaxWidth / cxChar;
- // si.nPage = cxClient / cxChar;
- // SetScrollInfo(hwnd, SB_HORZ, &si, TRUE);
- // return 0;
- //
- // case WM_VSCROLL:
- // si.cbSize = sizeof(si);
- // si.fMask = SIF_ALL;
- // GetScrollInfo(hwnd, SB_VERT, &si);
- // iVertPos = si.nPos;
- //
- // switch (LOWORD(wParam))
- // {
- // case SB_TOP:
- // si.nPos = si.nMin;
- // break;
- //
- // case SB_BOTTOM:
- // si.nPos = si.nMax;
- // break;
- //
- // case SB_LINEUP:
- // si.nPos -= 1;
- // break;
- //
- // case SB_LINEDOWN:
- // si.nPos += 1;
- // break;
- //
- // case SB_PAGEUP:
- // si.nPos -= si.nPage;
- // break;
- //
- // case SB_PAGEDOWN:
- // si.nPos += si.nPage;
- // break;
- //
- // case SB_THUMBTRACK:
- // si.nPos = si.nTrackPos;
- // break;
- //
- // default:
- // break;
- // }
- //
- // si.fMask = SIF_POS;
- // SetScrollInfo(hwnd, SB_VERT, &si, TRUE);
- // GetScrollInfo(hwnd, SB_VERT, &si);
- // if (si.nPos != iVertPos)
- // {
- // ScrollWindow(hwnd, 0, cyChar * (iVertPos - si.nPos), NULL, NULL);
- // UpdateWindow(hwnd);
- // }
- // return 0;
- //
- // case WM_HSCROLL:
- // si.cbSize = sizeof(si);
- // si.fMask = SIF_ALL;
- //
- // GetScrollInfo(hwnd, SB_HORZ, &si);
- // iHorzPos = si.nPos;
- //
- // switch (LOWORD(wParam))
- // {
- // case SB_LINELEFT:
- // si.nPos -= 1;
- // break;
- //
- // case SB_LINERIGHT:
- // si.nPos += 1;
- // break;
- //
- // case SB_PAGELEFT:
- // si.nPos -= si.nPage;
- // break;
- //
- // case SB_PAGERIGHT:
- // si.nPos += si.nPage;
- // break;
- //
- // case SB_THUMBPOSITION:
- // si.nPos = si.nTrackPos;
- // break;
- //
- // default:
- // break;
- // }
- //
- // si.fMask = SIF_POS;
- // SetScrollInfo(hwnd, SB_HORZ, &si, TRUE);
- // GetScrollInfo(hwnd, SB_HORZ, &si);
- //
- // if (si.nPos != iHorzPos)
- // {
- // ScrollWindow(hwnd, cxChar * (iHorzPos - si.nPos), 0, NULL, NULL);
- // }
- // return 0;
- //
- // case WM_KEYDOWN:
- // switch (wParam)
- // {
- // case VK_HOME:
- // SendMessage(hwnd, WM_VSCROLL, SB_TOP, 0);
- // break;
- //
- // case VK_END:
- // SendMessage(hwnd, WM_VSCROLL, SB_BOTTOM, 0);
- // break;
- //
- // case VK_PRIOR:
- // SendMessage(hwnd, WM_VSCROLL, SB_PAGEUP, 0);
- // break;
- // case VK_NEXT:
- // SendMessage(hwnd, WM_VSCROLL, SB_PAGEDOWN, 0);
- // break;
- // case VK_UP:
- // SendMessage(hwnd, WM_VSCROLL, SB_LINEUP, 0);
- // break;
- // case VK_DOWN:
- // SendMessage(hwnd, WM_VSCROLL, SB_LINEDOWN, 0);
- // break;
- // case VK_LEFT:
- // SendMessage(hwnd, WM_HSCROLL, SB_PAGEUP, 0);
- // break;
- // case VK_RIGHT:
- // SendMessage(hwnd, WM_HSCROLL, SB_PAGEDOWN, 0);
- // break;
- // }
- // return 0;
- //
- // case WM_MOUSEWHEEL:
- // if ((iDeltaPerLine == 0)) break;
- // iAccumDelta += (short)HIWORD(wParam);
- // while (iAccumDelta >= iDeltaPerLine)
- // {
- // SendMessage(hwnd, WM_VSCROLL, SB_LINEUP, 0);
- // iAccumDelta -= iDeltaPerLine;
- // }
- //
- // while (iAccumDelta <= -iDeltaPerLine)
- // {
- // SendMessage(hwnd, WM_VSCROLL, SB_LINEDOWN, 0);
- // iAccumDelta += iDeltaPerLine;
- // }
- // return 0;
- //
- // case WM_PAINT:
- // hdc = BeginPaint(hwnd, &ps);
- // si.cbSize = sizeof(si);
- // si.fMask = SIF_POS;
- // GetScrollInfo(hwnd, SB_VERT, &si);
- // iVertPos = si.nPos;
- // GetScrollInfo(hwnd, SB_HORZ, &si);
- // iHorzPos = si.nPos;
- // iPaintBeg = max (0, iVertPos + ps.rcPaint.top / cyChar);
- // iPaintEnd = min (NUMLINES - 1, iVertPos + ps.rcPaint.bottom / cyChar);
- //
- // for (i = iPaintBeg; i <= iPaintEnd; i++)
- // {
- // x = cxChar * (1 - iHorzPos);
- // y = cyChar * (i - iVertPos);
- // TextOut(hdc, x, y,
- // sysmetrics[i].szLabel,
- // lstrlen(sysmetrics[i].szLabel));
- // TextOut(hdc, x + 22 * cxCaps, y,
- // sysmetrics[i].szDesc,
- // lstrlen(sysmetrics[i].szDesc));
- // SetTextAlign(hdc, TA_RIGHT | TA_TOP);
- // TextOut(hdc, x + 22 * cxCaps + 40 * cxChar, y, szBuffer,
- // wsprintf(szBuffer, TEXT("%5d"),
- // GetSystemMetrics(sysmetrics[i].iIndex)));
- // SetTextAlign(hdc, TA_LEFT | TA_TOP);
- // }
- // EndPaint(hwnd, &ps);
- // return 0;
- //
- // case WM_DESTROY:
- // PostQuitMessage(0);
- // return 0;
- // }
- // return DefWindowProc(hwnd, message, wParam, lParam);
- //}
- //BLOCKOUT2
- //#include<Windows.h>
- //
- //LRESULT CALLBACK WndProc(HWND, UINT, WPARAM, LPARAM);
- //int WINAPI WinMain(HINSTANCE hInstance, HINSTANCE hPrevInstance, PSTR szCmdLine, int iCmdShow)
- //{
- // static TCHAR szAppName[] = TEXT("BlokOut2");
- // HWND hwnd;
- // MSG msg;
- // WNDCLASS wndclass;
- // wndclass.style = CS_HREDRAW | CS_VREDRAW;
- // wndclass.lpfnWndProc = WndProc;
- // wndclass.cbClsExtra = 0;
- // wndclass.cbWndExtra = 0;
- // wndclass.hInstance = hInstance;
- // wndclass.hIcon = LoadIcon(NULL, IDI_APPLICATION);
- // wndclass.hCursor = LoadCursor(NULL, IDC_ARROW);
- // wndclass.hbrBackground = (HBRUSH)GetStockObject(WHITE_BRUSH);
- // wndclass.lpszMenuName = NULL;
- // wndclass.lpszClassName = szAppName;
- //
- // if (!RegisterClass(&wndclass))
- // {
- // MessageBox(NULL, TEXT("Program requires Windows NT!"),
- // szAppName, MB_ICONERROR);
- // return 0;
- // }
- // hwnd = CreateWindow(szAppName, TEXT("Mouse Button & Capture Demo"),
- // WS_OVERLAPPEDWINDOW,
- // CW_USEDEFAULT, CW_USEDEFAULT,
- // CW_USEDEFAULT, CW_USEDEFAULT,
- // NULL, NULL, hInstance, NULL);
- // ShowWindow(hwnd, iCmdShow);
- // UpdateWindow(hwnd);
- //
- // while (GetMessage(&msg, NULL, 0, 0))
- // {
- // TranslateMessage(&msg);
- // DispatchMessage(&msg);
- // }
- // return msg.wParam;
- //
- //}
- //
- //void DrawBoxOutline(HWND hwnd, POINT ptBeg, POINT ptEnd)
- //{
- // HDC hdc;
- // hdc = GetDC(hwnd);
- // SetROP2(hdc, R2_NOT);
- // SelectObject(hdc, GetStockObject(NULL_BRUSH));
- // Rectangle(hdc, ptBeg.x, ptBeg.y, ptEnd.x, ptEnd.y);
- // ReleaseDC(hwnd, hdc);
- //}
- //
- //LRESULT CALLBACK WndProc(HWND hwnd, UINT message, WPARAM wParam, LPARAM lParam)
- //{
- // static BOOL fBlocking, fValidBox;
- // static POINT ptBeg, ptEnd, ptBoxBeg, ptBoxEnd;
- // HDC hdc;
- // PAINTSTRUCT ps;
- //
- // switch (message)
- // {
- // case WM_LBUTTONDOWN:
- // ptBeg.x = ptEnd.x = LOWORD(lParam);
- // ptBeg.y = ptEnd.y = HIWORD(lParam);
- //
- // DrawBoxOutline(hwnd, ptBeg, ptEnd);
- // SetCapture(hwnd);
- // SetCursor(LoadCursor(NULL, IDC_CROSS));
- //
- // fBlocking = TRUE;
- // return 0;
- //
- // case WM_MOUSEMOVE:
- // if (fBlocking)
- // {
- // SetCursor(LoadCursor(NULL, IDC_CROSS));
- // DrawBoxOutline(hwnd, ptBeg, ptEnd);
- // ptEnd.x = LOWORD(lParam);
- // ptEnd.y = HIWORD(lParam);
- // DrawBoxOutline(hwnd, ptBeg, ptEnd);
- // }
- // return 0;
- //
- // case WM_LBUTTONUP:
- // if (fBlocking)
- // {
- // DrawBoxOutline(hwnd, ptBeg, ptEnd);
- // ptBoxBeg = ptBeg;
- // ptBoxEnd.x = LOWORD(lParam);
- // ptBoxEnd.y = HIWORD(lParam);
- // ReleaseCapture();
- // SetCursor(LoadCursor(NULL, IDC_ARROW));
- // fBlocking = FALSE;
- // fValidBox = TRUE;
- // InvalidateRect(hwnd, NULL, TRUE);
- //
- // }
- // return 0;
- //
- // case WM_CHAR:
- // if (fBlocking & wParam == '\x1B')
- // {
- // DrawBoxOutline(hwnd, ptBeg, ptEnd);
- // ReleaseCapture();
- // SetCursor(LoadCursor(NULL, IDC_ARROW));
- //
- // fBlocking = FALSE;
- // }
- // return 0;
- //
- // case WM_PAINT:
- // hdc = BeginPaint(hwnd, &ps);
- // if (fValidBox)
- // {
- // SelectObject(hdc, GetStockObject(BLACK_BRUSH));
- // Rectangle(hdc, ptBoxBeg.x, ptBoxBeg.y, ptBoxEnd.x, ptBoxEnd.y);
- // }
- //
- // if (fBlocking)
- // {
- // SetROP2(hdc, R2_NOT);
- // SelectObject(hdc, GetStockObject(NULL_BRUSH));
- // Rectangle(hdc, ptBeg.x, ptBeg.y, ptEnd.x, ptEnd.y);
- // }
- //
- // EndPaint(hwnd, &ps);
- // return 0;
- //
- // case WM_DESTROY:
- // PostQuitMessage(0);
- // return 0;
- // }
- //
- // return DefWindowProc(hwnd, message, wParam, lParam);
- //}
- //BLOKOUT
- //#include<Windows.h>
- //
- //LRESULT CALLBACK WndProc(HWND, UINT, WPARAM, LPARAM);
- //
- //int WINAPI WinMain(HINSTANCE hInstance, HINSTANCE hPrevInstance, PSTR szCmdLine, int iCmdShow)
- //{
- // static TCHAR szAppName[] = TEXT("Blokout1");
- // HWND hwnd;
- // MSG msg;
- // WNDCLASS wndclass;
- //
- // wndclass.style = CS_HREDRAW | CS_VREDRAW;
- // wndclass.lpfnWndProc = WndProc;
- // wndclass.cbClsExtra = 0;
- // wndclass.cbWndExtra = 0;
- // wndclass.hInstance = hInstance;
- // wndclass.hIcon = LoadIcon(NULL, IDI_APPLICATION);
- // wndclass.hCursor = LoadCursor(NULL, IDC_ARROW);
- // wndclass.hbrBackground = (HBRUSH)GetStockObject(WHITE_BRUSH);
- // wndclass.lpszMenuName = NULL;
- // wndclass.lpszClassName = szAppName;
- //
- // if (!RegisterClass(&wndclass))
- // {
- // MessageBox(NULL, TEXT("Program requires Windows NT!"), szAppName, MB_ICONERROR);
- // return 0;
- // }
- //
- // hwnd = CreateWindow(szAppName, TEXT("Mouse Button Demo"),
- // WS_OVERLAPPEDWINDOW,
- // CW_USEDEFAULT, CW_USEDEFAULT,
- // CW_USEDEFAULT, CW_USEDEFAULT,
- // NULL, NULL, hInstance, NULL);
- // ShowWindow(hwnd, iCmdShow);
- // UpdateWindow(hwnd);
- // while (GetMessage(&msg, NULL, 0, 0))
- // {
- // TranslateMessage(&msg);
- // DispatchMessage(&msg);
- // }
- // return msg.wParam;
- //
- //}
- //
- //void DrawBoxOutline(HWND hwnd, POINT ptBeg, POINT ptEnd)
- //{
- // HDC hdc;
- // hdc = GetDC(hwnd);
- // SetROP2(hdc, R2_NOT);
- // SelectObject(hdc, GetStockObject(NULL_BRUSH));
- // Rectangle(hdc, ptBeg.x, ptBeg.y, ptEnd.x, ptEnd.y);
- // ReleaseDC(hwnd, hdc);
- //
- //}
- //
- //LRESULT CALLBACK WndProc(HWND hwnd, UINT message, WPARAM wParam, LPARAM lParam)
- //{
- // static BOOL fBlocking, fValidBox;
- // static POINT ptBeg, ptEnd, ptBoxBeg, ptBoxEnd;
- // HDC hdc;
- // PAINTSTRUCT ps;
- //
- // switch (message)
- // {
- // case WM_LBUTTONDOWN:
- // ptBeg.x = ptEnd.x = LOWORD(lParam);
- // ptBeg.y = ptEnd.y = HIWORD(lParam);
- //
- // DrawBoxOutline(hwnd, ptBeg, ptEnd);
- // SetCursor(LoadCursor(NULL, IDC_CROSS));
- // fBlocking = TRUE;
- // return 0;
- //
- // case WM_MOUSEMOVE:
- // if (fBlocking)
- // {
- // SetCursor(LoadCursor(NULL, IDC_CROSS));
- // DrawBoxOutline(hwnd, ptBeg, ptEnd);
- // ptEnd.x = LOWORD(lParam);
- // ptEnd.y = HIWORD(lParam);
- // DrawBoxOutline(hwnd, ptBeg, ptEnd);
- // }
- // return 0;
- //
- // case WM_LBUTTONUP:
- // if (fBlocking)
- // {
- // DrawBoxOutline(hwnd, ptBeg, ptEnd);
- //
- // ptBoxBeg = ptBeg;
- // ptBoxEnd.x = LOWORD(lParam);
- // ptBoxEnd.y = HIWORD(lParam);
- //
- // SetCursor(LoadCursor(NULL, IDC_ARROW));
- // fBlocking = FALSE;
- // fValidBox = TRUE;
- // InvalidateRect(hwnd, NULL, TRUE);
- // }
- // return 0;
- //
- // case WM_CHAR:
- // if (fBlocking & wParam == '\x1B')
- // {
- // DrawBoxOutline(hwnd, ptBeg, ptEnd);
- // SetCursor(LoadCursor(NULL, IDC_ARROW));
- // fBlocking = FALSE;
- // }
- // return 0;
- //
- // case WM_PAINT:
- // hdc = BeginPaint(hwnd, &ps);
- // if (fValidBox)
- // {
- // SelectObject(hdc, GetStockObject(BLACK_BRUSH));
- // Rectangle(hdc, ptBoxBeg.x, ptBoxBeg.y, ptBoxEnd.x, ptBoxEnd.y);
- // }
- //
- // if (fBlocking)
- // {
- // SetROP2(hdc, R2_NOT);
- // SelectObject(hdc, GetStockObject(NULL_BRUSH));
- // Rectangle(hdc, ptBeg.x, ptBeg.y, ptEnd.x, ptEnd.y);
- // }
- // EndPaint(hwnd, &ps);
- // return 0;
- //
- // case WM_DESTROY:
- // PostQuitMessage(0);
- // return 0;
- // }
- //
- // return DefWindowProc(hwnd, message, wParam, lParam);
- //}
- //CHECKER4
- //#include<Windows.h>
- //#define DIVISIONS 5
- //
- //LRESULT CALLBACK WndProc(HWND, UINT, WPARAM, LPARAM);
- //LRESULT CALLBACK ChildWndProc(HWND, UINT, WPARAM, LPARAM);
- //
- //int idFocus = 0;
- //TCHAR szChildClass[] = TEXT("Checker4_Child");
- //
- //int WINAPI WinMain(HINSTANCE hInstance, HINSTANCE hPrevInstance, PSTR szCmdLine, int iCmdShow)
- //{
- // static TCHAR szAppName[] = TEXT("Checker4");
- // HWND hwnd;
- // MSG msg;
- // WNDCLASS wndclass;
- //
- // wndclass.style = CS_HREDRAW || CS_VREDRAW;
- // wndclass.lpfnWndProc = WndProc;
- // wndclass.cbClsExtra = 0;
- // wndclass.cbWndExtra = 0;
- // wndclass.hInstance = hInstance;
- // wndclass.hIcon = LoadIcon(NULL, IDI_APPLICATION);
- // wndclass.hCursor = LoadCursor(NULL, IDC_ARROW);
- // wndclass.hbrBackground = (HBRUSH)GetStockObject(WHITE_BRUSH);
- // wndclass.lpszMenuName = NULL;
- // wndclass.lpszClassName = szAppName;
- //
- // if (!RegisterClass(&wndclass))
- // {
- // MessageBox(NULL, TEXT("Program requires Windows NT!"), szAppName, MB_ICONERROR);
- // return 0;
- // }
- //
- // wndclass.lpfnWndProc = ChildWndProc;
- // wndclass.cbWndExtra = sizeof(long);
- // wndclass.hIcon = NULL;
- // wndclass.lpszClassName = szChildClass;
- // RegisterClass(&wndclass);
- //
- // hwnd = CreateWindow(szAppName, TEXT("Checker4 Mouse Hit−Test Demo"),
- // WS_OVERLAPPEDWINDOW,
- // CW_USEDEFAULT, CW_USEDEFAULT,
- // CW_USEDEFAULT, CW_USEDEFAULT,
- // NULL, NULL, hInstance, NULL);
- //
- // ShowWindow(hwnd, iCmdShow);
- // UpdateWindow(hwnd);
- // while (GetMessage(&msg, NULL, 0, 0))
- // {
- // TranslateMessage(&msg);
- // DispatchMessage(&msg);
- // }
- // return msg.wParam;
- //
- //}
- //
- //LRESULT CALLBACK WndProc(HWND hwnd, UINT message, WPARAM wParam, LPARAM lParam)
- //{
- // static HWND hwndChild[DIVISIONS][DIVISIONS];
- // int cxBlock, cyBlock, x, y;
- // switch (message)
- // {
- // case WM_CREATE:
- // for (x = 0; x < DIVISIONS; x++)
- // {
- // for (y = 0; y < DIVISIONS; y++)
- // {
- // hwndChild[x][y] = CreateWindow(szChildClass, NULL,
- // WS_CHILDWINDOW | WS_VISIBLE,
- // 0, 0, 0, 0,
- // hwnd, (HMENU)(y << 8 | x),
- // (HINSTANCE)GetWindowLong(hwnd, GWL_HINSTANCE),
- // NULL);
- // }
- // }
- // return 0;
- //
- // case WM_SIZE:
- // cxBlock = LOWORD(lParam) / DIVISIONS;
- // cyBlock = HIWORD(lParam) / DIVISIONS;
- //
- // for (x = 0; x < DIVISIONS; x++)
- // {
- // for (y = 0; y < DIVISIONS; y++)
- // {
- // MoveWindow(hwndChild[x][y], x*cxBlock, y*cyBlock, cxBlock, cyBlock, TRUE);
- // }
- // }
- // return 0;
- //
- // case WM_LBUTTONDOWN:
- // MessageBeep(0);
- // return 0;
- //
- // case WM_SETFOCUS:
- // SetFocus(GetDlgItem(hwnd, idFocus));
- // return 0;
- //
- // case WM_KEYDOWN:
- // x = idFocus & 0xFF;
- // y = idFocus >> 8;
- //
- // switch (wParam)
- // {
- // case VK_UP: y--; break;
- // case VK_DOWN: y++; break;
- // case VK_LEFT: x--; break;
- // case VK_RIGHT: x++; break;
- // case VK_HOME: x = y = 0; break;
- // case VK_END: x = y = DIVISIONS - 1; break;
- // default: return 0;
- // }
- // x = (x + DIVISIONS) % DIVISIONS;
- // y = (y + DIVISIONS) % DIVISIONS;
- //
- // idFocus = y << 8 | x;
- // SetFocus(GetDlgItem(hwnd, idFocus));
- // return 0;
- //
- // case WM_DESTROY:
- // PostQuitMessage(0);
- // return 0;
- // }
- //
- // return DefWindowProc(hwnd, message, wParam, lParam);
- //}
- //
- //LRESULT CALLBACK ChildWndProc(HWND hwnd, UINT message, WPARAM wParam, LPARAM lParam)
- //{
- // HDC hdc;
- // PAINTSTRUCT ps;
- // RECT rect;
- //
- // switch (message)
- // {
- // case WM_CREATE:
- // SetWindowLong(hwnd, 0, 0);
- // return 0;
- //
- // case WM_KEYDOWN:
- // if (wParam != VK_RETURN && wParam != VK_SPACE)
- // {
- // SendMessage(GetParent(hwnd), message, wParam, lParam);
- // return 0;
- // }
- //
- // case WM_LBUTTONDOWN:
- // SetWindowLong(hwnd, 0, 01 ^ GetWindowLong(hwnd, 0));
- // SetFocus(hwnd);
- // InvalidateRect(hwnd, NULL, FALSE);
- // return 0;
- //
- // case WM_SETFOCUS:
- // idFocus = GetWindowLong(hwnd, GWL_ID);
- //
- // case WM_KILLFOCUS:
- // InvalidateRect(hwnd, NULL, TRUE);
- // return 0;
- //
- // case WM_PAINT:
- // hdc = BeginPaint(hwnd, &ps);
- // GetClientRect(hwnd, &rect);
- // Rectangle(hdc, 0, 0, rect.right, rect.bottom);
- //
- // if (GetWindowLong(hwnd, 0))
- // {
- // MoveToEx(hdc, 0, 0, NULL);
- // LineTo(hdc, rect.right, rect.bottom);
- // MoveToEx(hdc, 0, rect.bottom, NULL);
- // LineTo(hdc, rect.right, 0);
- // }
- //
- // if (hwnd = GetFocus())
- // {
- // rect.left += rect.right / 10;
- // rect.right -= rect.left;
- // rect.top += rect.bottom / 10;
- // rect.bottom -= rect.top;
- //
- // SelectObject(hdc, GetStockObject(NULL_BRUSH));
- // SelectObject(hdc, CreatePen(PS_DASH, 0, 0));
- // Rectangle(hdc, rect.left, rect.top, rect.right, rect.bottom);
- // DeleteObject(SelectObject(hdc, GetStockObject(BLACK_PEN)));
- // }
- //
- // EndPaint(hwnd, &ps);
- // return 0;
- // }
- //
- // return DefWindowProc(hwnd, message, wParam, lParam);
- //}
- //CHECKER3
- //#include<Windows.h>
- //#define DIVISIONS 5
- //
- //LRESULT CALLBACK WndProc(HWND, UINT, WPARAM, LPARAM);
- //LRESULT CALLBACK ChildWndProc(HWND, UINT, WPARAM, LPARAM);
- //
- //TCHAR szChildClass[] = TEXT("Checker3_Child");
- //
- //int WINAPI WinMain(HINSTANCE hInstance, HINSTANCE hPrevInstance, PSTR szCmdLine, int iCmdShow)
- //{
- // static TCHAR szAppName[] = TEXT("Checker3");
- // HWND hwnd;
- // MSG msg;
- // WNDCLASS wndclass;
- //
- // wndclass.style = CS_HREDRAW | CS_VREDRAW;
- // wndclass.lpfnWndProc = WndProc;
- // wndclass.cbClsExtra = 0;
- // wndclass.cbWndExtra = 0;
- // wndclass.hInstance = hInstance;
- // wndclass.hIcon = LoadIcon(NULL, IDI_APPLICATION);
- // wndclass.hCursor = LoadCursor(NULL, IDC_ARROW);
- // wndclass.hbrBackground = (HBRUSH)GetStockObject(WHITE_BRUSH);
- // wndclass.lpszMenuName = NULL;
- // wndclass.lpszClassName = szAppName;
- //
- // if (!RegisterClass(&wndclass))
- // {
- // MessageBox(NULL, TEXT("Program requires Windows NT!"),
- // szAppName, MB_ICONERROR);
- // return 0;
- // }
- // wndclass.lpfnWndProc = ChildWndProc;
- // wndclass.cbWndExtra = sizeof(long);
- // wndclass.hIcon = NULL;
- // wndclass.lpszClassName = szChildClass;
- //
- // hwnd = CreateWindow(szAppName, TEXT("Checker3 Mouse Hit−Test Demo"),
- // WS_OVERLAPPEDWINDOW,
- // CW_USEDEFAULT, CW_USEDEFAULT,
- // CW_USEDEFAULT, CW_USEDEFAULT,
- // NULL, NULL, hInstance, NULL);
- // ShowWindow(hwnd, iCmdShow);
- // UpdateWindow(hwnd);
- //
- // while (GetMessage(&msg, NULL, 0, 0))
- // {
- // TranslateMessage(&msg);
- // DispatchMessage(&msg);
- // }
- // return msg.wParam;
- //}
- //
- //LRESULT CALLBACK WndProc(HWND hwnd, UINT message, WPARAM wParam, LPARAM lParam)
- //{
- // static HWND hwndChild[DIVISIONS][DIVISIONS];
- // int cxBlock, cyBlock, x, y;
- // switch (message)
- // {
- // case WM_CREATE:
- // for (x = 0; x < DIVISIONS; x++)
- // {
- // for (y = 0; y < DIVISIONS; y++)
- // {
- // hwndChild[x][y] = CreateWindow(szChildClass, NULL, WS_CHILDWINDOW | WS_VISIBLE, 0, 0, 0, 0, hwnd, (HMENU)(y << 8 | x), (HINSTANCE)GetWindowLong(hwnd, GWL_HINSTANCE), NULL);
- // return 0;
- // }
- // }
- //
- // case WM_SIZE:
- // cxBlock = LOWORD(lParam) / DIVISIONS;
- // cyBlock = HIWORD(lParam) / DIVISIONS;
- // for (x = 0; x < DIVISIONS; x++)
- // {
- // for (y = 0; y < DIVISIONS; y++)
- // {
- // MoveWindow(hwndChild[x][y], x*cxBlock, y*cyBlock, cxBlock, cyBlock, TRUE);
- // }
- // }
- // return 0;
- //
- // case WM_LBUTTONDOWN:
- // MessageBeep(0);
- // return 0;
- //
- // case WM_DESTROY:
- // PostQuitMessage(0);
- // return 0;
- // }
- // return DefWindowProc(hwnd, message, wParam, lParam);
- //
- //}
- //
- //LRESULT CALLBACK ChildWndProc(HWND hwnd, UINT message, WPARAM wParam, LPARAM lParam)
- //{
- // HDC hdc;
- // PAINTSTRUCT ps;
- // RECT rect;
- //
- // switch (message)
- // {
- // case WM_CREATE:
- // SetWindowLong(hwnd, 0, 0);
- // return 0;
- //
- // case WM_LBUTTONDOWN:
- // SetWindowLong(hwnd, 0, 1 ^ GetWindowLong(hwnd, 0));
- // InvalidateRect(hwnd, NULL, FALSE);
- // return 0;
- //
- // case WM_PAINT:
- // hdc = BeginPaint(hwnd, &ps);
- // GetClientRect(hwnd, &rect);
- //
- // Rectangle(hdc, 0, 0, rect.right, rect.bottom);
- //
- // if (GetWindowLong(hwnd, 0))
- // {
- // MoveToEx(hdc, 0, 0, NULL);
- // LineTo(hdc, rect.right, rect.bottom);
- // MoveToEx(hdc, 0, rect.bottom, NULL);
- // LineTo(hdc, rect.right, 0);
- // }
- //
- // EndPaint(hwnd, &ps);
- // return 0;
- // }
- // return DefWindowProc(hwnd, message, wParam, lParam);
- //}
- //CHECKER2
- //#include<windows.h>
- //#define DIVISIONS 5
- //
- //LRESULT CALLBACK WndProc(HWND, UINT, WPARAM, LPARAM);
- //
- //int WINAPI WinMain(HINSTANCE hInstance, HINSTANCE hPrevInstance, PSTR szCmdLine, int iCmdShow)
- //{
- // static TCHAR szAppName[] = TEXT("Checker2");
- // HWND hwnd;
- // MSG msg;
- // WNDCLASS wndclass;
- // wndclass.style = CS_HREDRAW | CS_VREDRAW;
- // wndclass.lpfnWndProc = WndProc;
- // wndclass.cbClsExtra = 0;
- // wndclass.cbWndExtra = 0;
- // wndclass.hInstance = hInstance;
- // wndclass.hIcon = LoadIcon(NULL, IDI_APPLICATION);
- // wndclass.hCursor = LoadCursor(NULL, IDC_ARROW);
- // wndclass.hbrBackground = (HBRUSH)GetStockObject(WHITE_BRUSH);
- // wndclass.lpszMenuName = NULL;
- // wndclass.lpszClassName = szAppName;
- //
- // if (!RegisterClass(&wndclass))
- // {
- // MessageBox(NULL, TEXT("Program requires Windows NT!"),
- // szAppName, MB_ICONERROR);
- // return 0;
- // }
- // hwnd = CreateWindow(szAppName, TEXT("Checker2 Mouse Hit−Test Demo"),
- // WS_OVERLAPPEDWINDOW,
- // CW_USEDEFAULT, CW_USEDEFAULT,
- // CW_USEDEFAULT, CW_USEDEFAULT,
- // NULL, NULL, hInstance, NULL);
- // ShowWindow(hwnd, iCmdShow);
- // UpdateWindow(hwnd);
- // while (GetMessage(&msg, NULL, 0, 0))
- // {
- // TranslateMessage(&msg);
- // DispatchMessage(&msg);
- // }
- // return msg.wParam;
- //}
- //
- //LRESULT CALLBACK WndProc(HWND hwnd, UINT message, WPARAM wParam, LPARAM lParam)
- //{
- // static BOOL fState[DIVISIONS][DIVISIONS];
- // static int cxBlock, cyBlock;
- // HDC hdc;
- // int x, y;
- // PAINTSTRUCT ps;
- // POINT point;
- // RECT rect;
- //
- // switch (message)
- // {
- // case WM_SIZE:
- // cxBlock = LOWORD(lParam) / DIVISIONS;
- // cyBlock = HIWORD(lParam) / DIVISIONS;
- // return 0;
- //
- // case WM_SETFOCUS:
- // ShowCursor(TRUE);
- // return 0;
- //
- // case WM_KILLFOCUS:
- // ShowCursor(FALSE);
- // return 0;
- //
- // case WM_KEYDOWN:
- // GetCursorPos(&point);
- // ScreenToClient(hwnd, &point);
- // x = max(0, min(DIVISIONS - 1, point.x / cxBlock));
- // y = max(0, min(DIVISIONS - 1, point.y / cyBlock));
- //
- // switch (wParam)
- // {
- // case VK_UP:
- // y--;
- // break;
- //
- // case VK_DOWN:
- // y++;
- // break;
- //
- // case VK_LEFT:
- // x--;
- // break;
- //
- // case VK_RIGHT:
- // x++;
- // break;
- //
- // case VK_HOME:
- // x = y = 0;
- // break;
- //
- // case VK_END:
- // x = y = DIVISIONS - 1;
- // break;
- //
- // case VK_RETURN:
- // case VK_SPACE:
- // SendMessage(hwnd, WM_LBUTTONDOWN, MK_LBUTTON, MAKELONG(x*cxBlock, y*cyBlock));
- // break;
- //
- // }
- //
- // x = (x + DIVISIONS) % DIVISIONS;
- // y = (y + DIVISIONS) % DIVISIONS;
- //
- // point.x = x*cxBlock + cxBlock / 2;
- // point.y = y*cyBlock + cyBlock / 2;
- //
- // ClientToScreen(hwnd, &point);
- // SetCursorPos(point.x, point.y);
- // return 0;
- //
- // case WM_LBUTTONDOWN:
- // x = LOWORD(lParam) / cxBlock;
- // y = HIWORD(lParam) / cyBlock;
- //
- // if (x < DIVISIONS && y < DIVISIONS)
- // {
- // fState[x][y] ^= 1;
- // rect.left = x*cxBlock;
- // rect.top = y*cyBlock;
- // rect.right = (x + 1) *cxBlock;
- // rect.bottom = (y + 1) * cyBlock;
- //
- // InvalidateRect(hwnd, &rect, FALSE);
- //
- // }
- // else MessageBeep(0);
- // return 0;
- //
- // case WM_PAINT:
- // hdc = BeginPaint(hwnd, &ps);
- // for (x = 0; x < DIVISIONS; x++)
- // for (y = 0; y < DIVISIONS; y++)
- // {
- // Rectangle(hdc, x*cxBlock, y*cyBlock, (x + 1)*cxBlock, (y + 1)*cyBlock);
- // if (fState[x][y])
- // {
- // MoveToEx(hdc, x*cxBlock, y*cyBlock, NULL);
- // LineTo(hdc, (x + 1)*cxBlock, (y + 1)*cyBlock);
- // MoveToEx(hdc, x*cxBlock, (y + 1)*cyBlock, NULL);
- // LineTo(hdc, (x + 1)*cxBlock, y*cyBlock);
- // }
- // }
- // EndPaint(hwnd, &ps);
- // return 0;
- //
- // case WM_DESTROY:
- // PostQuitMessage(0);
- // return 0;
- // }
- //
- // return DefWindowProc(hwnd, message, wParam, lParam);
- //}
- //CHECKER1
- //#include<Windows.h>
- //#define DIVISIONS 5
- //
- //LRESULT CALLBACK WndProc(HWND, UINT, WPARAM, LPARAM);
- //
- //int WINAPI WinMain(HINSTANCE hInstance, HINSTANCE hPrevInstance, PSTR szCmdLine, int iCmdShow)
- //{
- // static TCHAR szAppName[] = TEXT("Checker1");
- // HWND hwnd;
- // MSG msg;
- // WNDCLASS wndclass;
- // wndclass.style = CS_HREDRAW || CS_VREDRAW;
- // wndclass.lpfnWndProc = WndProc;
- // wndclass.cbClsExtra = 0;
- // wndclass.cbWndExtra = 0;
- // wndclass.hInstance = hInstance;
- // wndclass.hIcon = LoadIcon(NULL, IDI_APPLICATION);
- // wndclass.hCursor = LoadCursor(NULL, IDC_ARROW);
- // wndclass.hbrBackground = (HBRUSH)GetStockObject(WHITE_BRUSH);
- // wndclass.lpszMenuName = NULL;
- // wndclass.lpszClassName = szAppName;
- //
- // if (!RegisterClass(&wndclass))
- // {
- // MessageBox(NULL, TEXT("Program requires Windows NT!"), szAppName, MB_ICONERROR);
- // return 0;
- // }
- //
- // hwnd = CreateWindow(szAppName, TEXT("Checker1 Mouse Hit-Test Demo"), WS_OVERLAPPEDWINDOW, CW_USEDEFAULT, CW_USEDEFAULT, CW_USEDEFAULT, CW_USEDEFAULT, NULL, NULL, hInstance, NULL);
- // ShowWindow(hwnd, iCmdShow);
- // UpdateWindow(hwnd);
- //
- // while (GetMessage(&msg, NULL, 0, 0))
- // {
- // TranslateMessage(&msg);
- // DispatchMessage(&msg);
- // }
- // return msg.wParam;
- //
- //}
- //
- //LRESULT CALLBACK WndProc(HWND hwnd, UINT message, WPARAM wParam, LPARAM lParam)
- //{
- // static BOOL fState[DIVISIONS][DIVISIONS];
- // static int cxBlock, cyBlock;
- // HDC hdc;
- // int x, y;
- // PAINTSTRUCT ps;
- // RECT rect;
- //
- // switch (message)
- // {
- // case WM_SIZE:
- // cxBlock = LOWORD(lParam) / DIVISIONS;
- // cyBlock = HIWORD(lParam) / DIVISIONS;
- // return 0;
- //
- // case WM_LBUTTONDOWN:
- // x = LOWORD(lParam) / cxBlock;
- // y = HIWORD(lParam) / cyBlock;
- //
- // if (x < DIVISIONS && y < DIVISIONS)
- // {
- // fState[x][y] ^= 1;
- // rect.left = x* cxBlock;
- // rect.top = y*cyBlock;
- // rect.right = (x + 1)*cxBlock;
- // rect.bottom = (y + 1)*cyBlock;
- //
- // InvalidateRect(hwnd, &rect, FALSE);
- // }
- // else
- // {
- // MessageBeep(0);
- // }
- // return 0;
- //
- // case WM_PAINT:
- // hdc = BeginPaint(hwnd, &ps);
- // for (x = 0; x < DIVISIONS; x++)
- // for (y = 0; y < DIVISIONS; y++)
- // {
- // Rectangle(hdc, x*cxBlock, y*cyBlock, (x + 1)*cxBlock, (y + 1)*cyBlock);
- // if (fState[x][y])
- // {
- // MoveToEx(hdc, x * cxBlock, y * cyBlock, NULL);
- // LineTo(hdc, (x + 1) * cxBlock, (y + 1) * cyBlock);
- // MoveToEx(hdc, x * cxBlock, (y + 1) * cyBlock, NULL);
- // LineTo(hdc, (x + 1) * cxBlock, y * cyBlock);
- // }
- // }
- // EndPaint(hwnd, &ps);
- // return 0;
- //
- // case WM_DESTROY:
- // PostQuitMessage(0);
- // return 0;
- // }
- // return DefWindowProc(hwnd, message, wParam, lParam);
- //
- //}
- //CONNECT
- //#include<Windows.h>
- //#define MAXPOINTS 1000
- //
- //LRESULT CALLBACK WndProc(HWND, UINT, WPARAM, LPARAM);
- //
- //int WINAPI WinMain(HINSTANCE hInstance, HINSTANCE hPrevInstance, PSTR szCmdLine, int iCmdShow)
- //{
- // static TCHAR szAppName[] = TEXT("Connect");
- // HWND hwnd;
- // MSG msg;
- // WNDCLASS wndclass;
- //
- // wndclass.style = CS_HREDRAW | CS_VREDRAW;
- // wndclass.lpfnWndProc = WndProc;
- // wndclass.cbClsExtra = 0;
- // wndclass.cbWndExtra = 0;
- // wndclass.hInstance = hInstance;
- // wndclass.hIcon = LoadIcon(NULL, IDI_APPLICATION);
- // wndclass.hCursor = LoadCursor(NULL, IDC_ARROW);
- // wndclass.hbrBackground = (HBRUSH)GetStockObject(WHITE_BRUSH);
- // wndclass.lpszMenuName = NULL;
- // wndclass.lpszClassName = szAppName;
- //
- // if (!RegisterClass(&wndclass))
- // {
- // MessageBox(NULL, TEXT("Program requires Windows NT!"), szAppName, MB_ICONERROR);
- // return 0;
- // }
- //
- // hwnd = CreateWindow(szAppName, TEXT("Connect-the-Points Mouse Demo"), WS_OVERLAPPEDWINDOW, CW_USEDEFAULT, CW_USEDEFAULT, CW_USEDEFAULT, CW_USEDEFAULT, NULL, NULL, hInstance, NULL);
- // ShowWindow(hwnd, iCmdShow);
- // UpdateWindow(hwnd);
- //
- // while (GetMessage(&msg, NULL, 0, 0))
- // {
- // TranslateMessage(&msg);
- // DispatchMessage(&msg);
- // }
- // return msg.wParam;
- //
- //}
- //
- //LRESULT CALLBACK WndProc(HWND hwnd, UINT message, WPARAM wParam, LPARAM lParam)
- //{
- // static POINT pt[MAXPOINTS];
- // static int iCount;
- // HDC hdc;
- // int i, j;
- // PAINTSTRUCT ps;
- //
- // switch (message)
- // {
- // case WM_LBUTTONDOWN:
- // iCount = 0;
- // InvalidateRect(hwnd, NULL, TRUE);
- // return 0;
- //
- // case WM_MOUSEMOVE:
- // if (wParam & MK_LBUTTON && iCount < 1000)
- // {
- // pt[iCount].x = LOWORD(lParam);
- // pt[iCount++].y = HIWORD(lParam);
- //
- // hdc = GetDC(hwnd);
- // SetPixel(hdc, LOWORD(lParam), HIWORD(lParam), 0);
- // ReleaseDC(hwnd, hdc);
- // }
- // return 0;
- //
- // case WM_LBUTTONUP:
- // InvalidateRect(hwnd, NULL, FALSE);
- // return 0;
- //
- // case WM_PAINT:
- // hdc = BeginPaint(hwnd, &ps);
- // SetCursor(LoadCursor(NULL, IDC_WAIT));
- // ShowCursor(TRUE);
- // for (i = 0; i < iCount - 1; i++)
- // {
- // for (j = i + 1; j < iCount; j++)
- // {
- // MoveToEx(hdc, pt[i].x, pt[i].y, NULL);
- // LineTo(hdc, pt[j].x, pt[j].y);
- // }
- // }
- //
- // ShowCursor(FALSE);
- // SetCursor(LoadCursor(NULL,IDC_ARROW));
- // EndPaint(hwnd, &ps);
- // return 0;
- //
- // case WM_DESTROY:
- // PostQuitMessage(0);
- // return 0;
- // }
- // return DefWindowProc(hwnd, message, wParam, lParam);
- //}
- //TYPER
- //#include<windows.h>
- //#define BUFFER(x,y) * (pBuffer+y * cxBuffer +x)
- //
- //LRESULT CALLBACK WndProc(HWND, UINT, WPARAM, LPARAM);
- //
- //int WINAPI WinMain(HINSTANCE hInstance, HINSTANCE hPrevInstance, PSTR szCmdLine, int iCmdShow)
- //{
- // static TCHAR szAppName[] = TEXT("Typer");
- // HWND hwnd;
- // MSG msg;
- // WNDCLASS wndclass;
- //
- // wndclass.style = CS_HREDRAW | CS_VREDRAW;
- // wndclass.lpfnWndProc = WndProc;
- // wndclass.cbClsExtra = 0;
- // wndclass.cbWndExtra = 0;
- // wndclass.hInstance = hInstance;
- // wndclass.hIcon = LoadIcon(NULL, IDI_APPLICATION);
- // wndclass.hCursor = LoadCursor(NULL, IDC_ARROW);
- // wndclass.hbrBackground = (HBRUSH)GetStockObject(WHITE_BRUSH);
- // wndclass.lpszMenuName = NULL;
- // wndclass.lpszClassName = szAppName;
- //
- // if (!RegisterClass(&wndclass))
- // {
- // MessageBox(NULL, TEXT("This program requires Windows NT!"), szAppName, MB_ICONERROR);
- // return 0;
- // }
- //
- // hwnd = CreateWindow(szAppName, TEXT("Typing Program"), WS_OVERLAPPEDWINDOW, CW_USEDEFAULT, CW_USEDEFAULT, CW_USEDEFAULT, CW_USEDEFAULT, NULL, NULL, hInstance, NULL);
- // ShowWindow(hwnd, iCmdShow);
- // UpdateWindow(hwnd);
- //
- // while (GetMessage(&msg, NULL, 0, 0))
- // {
- // TranslateMessage(&msg);
- // DispatchMessage(&msg);
- // }
- // return msg.wParam;
- //
- //}
- //
- //LRESULT CALLBACK WndProc(HWND hwnd, UINT message, WPARAM wParam, LPARAM lParam)
- //{
- // static DWORD dwCharSet = DEFAULT_CHARSET;
- // static int cxChar, cyChar, cxClient, cyClient, cxBuffer, cyBuffer, xCaret, yCaret;
- // static TCHAR * pBuffer = NULL;
- // HDC hdc;
- // int x, y, i;
- // PAINTSTRUCT ps;
- // TEXTMETRIC tm;
- //
- // switch (message)
- // {
- // case WM_INPUTLANGCHANGE:
- // dwCharSet = wParam;
- //
- // case WM_CREATE:
- // hdc = GetDC(hwnd);
- // SelectObject(hdc, CreateFont(0, 0, 0, 0, 0, 0, 0, 0,
- // dwCharSet, 0, 0, 0, FIXED_PITCH, NULL));
- // GetTextMetrics(hdc, &tm);
- // cxChar = tm.tmAveCharWidth;
- // cyChar = tm.tmHeight;
- // DeleteObject(SelectObject(hdc, GetStockObject(SYSTEM_FONT)));
- // ReleaseDC(hwnd, hdc);
- //
- // case WM_SIZE:
- // cxClient = LOWORD(lParam);
- // cyClient = HIWORD(lParam);
- //
- // cxBuffer = max(1, cxClient / cxChar);
- // cyBuffer = max(1, cyClient / cyChar);
- //
- // if (pBuffer != NULL) free(pBuffer);
- // pBuffer = (TCHAR *)malloc(cxBuffer * cyBuffer * sizeof(TCHAR));
- // for (y = 0; y < cyBuffer; y++)
- // for (x = 0; x < cxBuffer; x++)
- // {
- // BUFFER(x, y) = ' ';
- // }
- // xCaret = 0;
- // yCaret = 0;
- //
- // if (hwnd = GetFocus()) SetCaretPos(xCaret * cxChar, yCaret * cyChar);
- // InvalidateRect(hwnd, NULL, TRUE);
- // return 0;
- //
- // case WM_SETFOCUS:
- // CreateCaret(hwnd, NULL, cxChar, cyChar);
- // SetCaretPos(xCaret * cxChar, yCaret * cyChar);
- // ShowCaret(hwnd);
- // return 0;
- //
- // case WM_KILLFOCUS:
- // HideCaret(hwnd);
- // DestroyCaret();
- // return 0;
- //
- // case WM_KEYDOWN:
- // switch (wParam)
- // {
- // case VK_HOME:
- // xCaret = 0;
- // break;
- //
- // case VK_END:
- // xCaret = cxBuffer - 1;
- // break;
- //
- // case VK_PRIOR:
- // yCaret = 0;
- // break;
- //
- // case VK_NEXT:
- // yCaret = cyBuffer - 1;
- // break;
- //
- // case VK_LEFT:
- // xCaret = max(xCaret - 1, 0);
- // break;
- //
- // case VK_RIGHT:
- // xCaret = min(xCaret + 1, cxBuffer - 1);
- // break;
- //
- // case VK_UP:
- // yCaret = max(yCaret - 1, 0);
- // break;
- //
- // case VK_DOWN:
- // yCaret = min(yCaret + 1, cyBuffer - 1);
- // break;
- //
- // case VK_DELETE:
- // for (x = xCaret; x < cxBuffer - 1; x++)
- // {
- // BUFFER(x, yCaret) = BUFFER(x + 1, yCaret);
- // }
- // BUFFER(cxBuffer - 1, yCaret) = ' ';
- // HideCaret(hwnd);
- // hdc = GetDC(hwnd);
- // SelectObject(hdc, CreateFont(0, 0, 0, 0, 0, 0, 0, 0,
- // dwCharSet, 0, 0, 0, FIXED_PITCH, NULL));
- // TextOut(hdc, xCaret * cxChar, yCaret * cyChar, &BUFFER(xCaret, yCaret), cxBuffer - xCaret);
- // DeleteObject(SelectObject(hdc, GetStockObject(SYSTEM_FONT)));
- // ReleaseDC(hwnd, hdc);
- // ShowCaret(hwnd);
- // break;
- //
- // }
- // SetCaretPos(xCaret*cxChar, yCaret*cyChar);
- // return 0;
- //
- // case WM_CHAR:
- // for (i = 0; i < (int)LOWORD(lParam); i++)
- // {
- // switch (wParam)
- // {
- // case '\b':
- // if (xCaret > 0)
- // {
- // xCaret--;
- // SendMessage(hwnd, WM_KEYDOWN, VK_DELETE, 1);
- // }
- // break;
- //
- // case '\t':
- // do
- // {
- // SendMessage(hwnd, WM_CHAR, ' ', 1);
- // } while (xCaret % 8 != 0);
- // break;
- //
- // case '\n':
- // if (++yCaret == cyBuffer) yCaret = 0;
- // break;
- //
- // case '\r':
- // xCaret = 0;
- // if (++yCaret == cyBuffer) yCaret = 0;
- // break;
- //
- // case '\x1B':
- // for (y = 0; y < cyBuffer; y++)
- // {
- // for (x = 0; x < cxBuffer; x++)
- // {
- // BUFFER(x,y) = ' ';
- // }
- // }
- // xCaret = 0;
- // yCaret = 0;
- //
- // InvalidateRect(hwnd, NULL, FALSE);
- // break;
- //
- // default:
- // BUFFER(xCaret, yCaret) = (TCHAR)wParam;
- // HideCaret(hwnd);
- // hdc = GetDC(hwnd);
- // SelectObject(hdc, CreateFont(0, 0, 0, 0, 0, 0, 0, 0,
- // dwCharSet, 0, 0, 0, FIXED_PITCH, NULL));
- // TextOut(hdc, xCaret * cxChar, yCaret * cyChar, &BUFFER(xCaret, yCaret), 1);
- // DeleteObject(SelectObject(hdc, GetStockObject(SYSTEM_FONT)));
- // ReleaseDC(hwnd, hdc);
- // ShowCaret(hwnd);
- //
- // if (++xCaret = cxBuffer)
- // {
- // xCaret = 0;
- // if (++yCaret == cyBuffer) yCaret = 0;
- // }
- // break;
- //
- // }
- // }
- //
- // SetCaretPos(xCaret*cxChar, yCaret * cyChar);
- // return 0;
- //
- // case WM_PAINT:
- // hdc = BeginPaint(hwnd, &ps);
- // SelectObject(hdc, CreateFont(0, 0, 0, 0, 0, 0, 0, 0,
- // dwCharSet, 0, 0, 0, FIXED_PITCH, NULL));
- // for (y = 0; y < cyBuffer; y++)
- // {
- // TextOut(hdc, 0, y*cyChar, &BUFFER(0, y), cxBuffer);
- // }
- // DeleteObject(SelectObject(hdc, GetStockObject(SYSTEM_FONT)));
- // EndPaint(hwnd, &ps);
- // return 0;
- //
- // case WM_DESTROY:
- // PostQuitMessage(0);
- // return 0;
- // }
- // return DefWindowProc(hwnd, message, wParam, lParam);
- //
- //}
- //KEYVIEW2
- //#include<windows.h>
- //
- //LRESULT CALLBACK WndProc(HWND, UINT, WPARAM, LPARAM);
- //
- //int WINAPI WinMain(HINSTANCE hInstance, HINSTANCE hPrevInstance, PSTR szCmdLine, int iCmdShow)
- //{
- // static TCHAR szAppName[] = TEXT("KeyView2");
- // HWND hwnd;
- // MSG msg;
- // WNDCLASS wndclass;
- //
- // wndclass.style = CS_HREDRAW || CS_VREDRAW;
- // wndclass.lpfnWndProc = WndProc;
- // wndclass.cbClsExtra = 0;
- // wndclass.cbWndExtra = 0;
- // wndclass.hInstance = hInstance;
- // wndclass.hIcon = LoadIcon(NULL, IDI_APPLICATION);
- // wndclass.hCursor = LoadCursor(NULL, IDC_ARROW);
- // wndclass.hbrBackground = (HBRUSH)GetStockObject(WHITE_BRUSH);
- // wndclass.lpszMenuName = NULL;
- // wndclass.lpszClassName = szAppName;
- //
- // if (!RegisterClass(&wndclass))
- // {
- // MessageBox(NULL, TEXT("This program requires Windows NT!"), szAppName, MB_ICONERROR);
- // return 0;
- // }
- //
- // hwnd = CreateWindow(szAppName, TEXT("Keyboard Message Viewer #2"), WS_OVERLAPPEDWINDOW, CW_USEDEFAULT, CW_USEDEFAULT, CW_USEDEFAULT, CW_USEDEFAULT, NULL, NULL, hInstance, NULL);
- // ShowWindow(hwnd, iCmdShow);
- // UpdateWindow(hwnd);
- //
- // while (GetMessage(&msg, NULL, 0, 0))
- // {
- // TranslateMessage(&msg);
- // DispatchMessage(&msg);
- // }
- // return msg.wParam;
- //
- //}
- //
- //LRESULT CALLBACK WndProc(HWND hwnd, UINT message, WPARAM wParam, LPARAM lParam)
- //{
- // static DWORD dwCharSet = DEFAULT_CHARSET;
- // static int cxClientMax, cyClientMax, cxClient, cyClient, cxChar, cyChar;
- // static int cLinesMax, cLines;
- // static PMSG pmsg;
- // static RECT rectScroll;
- // static TCHAR szTop[] = TEXT("Message Key Char ") TEXT("Repeat Scan Ext ALT Prev Tran");
- // static TCHAR szUnd[] = TEXT("_______ ___ ____") TEXT("______ ____ ___ ___ ____ ____");
- // static TCHAR * szFormat[2] = {
- // TEXT("%−13s %3d %−15s%c%6u %4d %3s %3s %4s %4s"),
- // TEXT("%−13s 0x%04X%1s%c %6u %4d %3s %3s %4s %4s") };
- // static TCHAR * szYes = TEXT("Yes");
- // static TCHAR * szNo = TEXT("No");
- // static TCHAR * szDown = TEXT("Down");
- // static TCHAR * szUp = TEXT("Up");
- //
- // static TCHAR * szMessage[] = {
- // TEXT("WM_KEYDOWN"), TEXT("WM_KEYUP"),
- // TEXT("WM_CHAR"), TEXT("WM_DEADCHAR"),
- // TEXT("WM_SYSKEYDOWN"), TEXT("WM_SYSKEYUP"),
- // TEXT("WM_SYSCHAR"), TEXT("WM_SYSDEADCHAR") };
- //
- // HDC hdc;
- // int i, iType;
- // PAINTSTRUCT ps;
- // TCHAR szBuffer[128], szKeyName[32];
- // TEXTMETRIC tm;
- //
- // switch (message)
- // {
- // case WM_INPUTLANGCHANGE:
- // dwCharSet = wParam;
- // case WM_CREATE:
- // case WM_DISPLAYCHANGE:
- // cxClientMax = GetSystemMetrics(SM_CXMAXIMIZED);
- // cyClientMax = GetSystemMetrics(SM_CYMAXIMIZED);
- //
- // hdc = GetDC(hwnd);
- // SelectObject(hdc, CreateFont(0, 0, 0, 0, 0, 0, 0, 0,
- // dwCharSet, 0, 0, 0, FIXED_PITCH, NULL));
- //
- // GetTextMetrics(hdc, &tm);
- // cxChar = tm.tmAveCharWidth;
- // cyChar = tm.tmHeight;
- // DeleteObject(SelectObject(hdc, GetStockObject(SYSTEM_FONT)));
- // ReleaseDC(hwnd, hdc);
- //
- // if (pmsg) free(pmsg);
- // cLinesMax = cyClientMax / cyChar;
- // pmsg = (PMSG)malloc(cLinesMax * sizeof(MSG));
- // cLines = 0;
- //
- // case WM_SIZE:
- // cxClient = LOWORD(lParam);
- // cyClient = HIWORD(lParam);
- // rectScroll.left = 0;
- // rectScroll.right = cxClient;
- // rectScroll.top = cyChar;
- // rectScroll.bottom = cyChar * (cyClient / cyChar);
- //
- // InvalidateRect(hwnd, NULL, TRUE);
- //
- // if (message == WM_INPUTLANGCHANGE) return TRUE;
- //
- // return 0;
- //
- // case WM_KEYDOWN:
- // case WM_KEYUP:
- // case WM_CHAR:
- // case WM_DEADCHAR:
- // case WM_SYSKEYDOWN:
- // case WM_SYSKEYUP:
- // case WM_SYSCHAR:
- // case WM_SYSDEADCHAR:
- // for (i = cLinesMax - 1; i > 0; i--)
- // {
- // pmsg[i] = pmsg[i - 1];
- // }
- //
- // pmsg[0].hwnd = hwnd;
- // pmsg[0].message = message;
- // pmsg[0].wParam = wParam;
- // pmsg[0].lParam = lParam;
- //
- // cLines = min(cLines + 1, cLinesMax);
- // ScrollWindow(hwnd, 0, -cyChar, &rectScroll, &rectScroll);
- // break;
- //
- // case WM_PAINT:
- // hdc = BeginPaint(hwnd, &ps);
- // SelectObject(hdc, CreateFont(0, 0, 0, 0, 0, 0, 0, 0,
- // dwCharSet, 0, 0, 0, FIXED_PITCH, NULL));
- //
- // SetBkMode(hdc, TRANSPARENT);
- // TextOut(hdc, 0, 0, szTop, lstrlen(szTop));
- // TextOut(hdc, 0, 0, szUnd, lstrlen(szUnd));
- // for (i = 0; i < min(cLines, cyClient / cyChar - 1); i++)
- // {
- // iType = pmsg[i].message == WM_CHAR || pmsg[i].message == WM_SYSCHAR ||
- // pmsg[i].message == WM_DEADCHAR ||
- // pmsg[i].message == WM_SYSDEADCHAR;
- // }
- //
- // GetKeyNameText(pmsg[i].lParam, szKeyName, sizeof(szKeyName) / sizeof(TCHAR));
- // TextOut(hdc, 0, (cyClient / cyChar - 1 - i)*cyChar, szBuffer, wsprintf(szBuffer, szFormat[iType], szMessage[pmsg[i].message - WM_KEYFIRST],
- // pmsg[i].wParam,
- // (iType ? TEXT(" ") : szKeyName),
- // (iType ? pmsg[i].wParam : ' '),
- // LOWORD(pmsg[i].lParam),
- // HIWORD(pmsg[i].lParam) & 0xFF,
- // 0x01000000 & pmsg[i].lParam ? szYes : szNo,
- // 0x20000000 & pmsg[i].lParam ? szYes : szNo,
- // 0x40000000 & pmsg[i].lParam ? szDown : szUp,
- // 0x80000000 & pmsg[i].lParam ? szUp : szDown));
- //
- // DeleteObject(SelectObject(hdc, GetStockObject(SYSTEM_FONT)));
- // EndPaint(hwnd, &ps);
- // return 0;
- //
- // case WM_DESTROY:
- // PostQuitMessage(0);
- // return 0;
- // }
- // return DefWindowProc(hwnd, message, wParam, lParam);
- //
- //}
- //STOKFONT
- //#include<Windows.h>
- //
- //LRESULT CALLBACK WndProc(HWND, UINT, WPARAM, LPARAM);
- //
- //int WINAPI WinMain(HINSTANCE hInstance, HINSTANCE hPrevInstance, PSTR szCmdLine, int iCmdShow)
- //{
- // static TCHAR szAppName[] = TEXT("StokFont");
- // HWND hwnd;
- // MSG msg;
- // WNDCLASS wndclass;
- //
- // wndclass.style = CS_HREDRAW || CS_VREDRAW;
- // wndclass.lpfnWndProc = WndProc;
- // wndclass.cbClsExtra = 0;
- // wndclass.cbWndExtra = 0;
- // wndclass.hInstance = hInstance;
- // wndclass.hIcon = LoadIcon(NULL, IDI_APPLICATION);
- // wndclass.hCursor = LoadCursor(NULL, IDC_ARROW);
- // wndclass.hbrBackground = (HBRUSH)GetStockObject(WHITE_BRUSH);
- // wndclass.lpszMenuName = NULL;
- // wndclass.lpszClassName = szAppName;
- //
- // if (!RegisterClass(&wndclass))
- // {
- // MessageBox(NULL, TEXT("Program requires Windows NT!"), szAppName, MB_ICONERROR);
- // return 0;
- // }
- //
- // hwnd = CreateWindow(szAppName, TEXT("Stock Fonts"), WS_OVERLAPPEDWINDOW, CW_USEDEFAULT, CW_USEDEFAULT, CW_USEDEFAULT, CW_USEDEFAULT, NULL, NULL, hInstance, NULL);
- // ShowWindow(hwnd, iCmdShow);
- // UpdateWindow(hwnd);
- //
- // while (GetMessage(&msg, NULL, 0, 0))
- // {
- // TranslateMessage(&msg);
- // DispatchMessage(&msg);
- // }
- // return msg.wParam;
- //
- //}
- //
- //LRESULT CALLBACK WndProc(HWND hwnd, UINT message, WPARAM wParam, LPARAM lParam)
- //{
- // static struct
- // {
- // int idStockFont;
- // TCHAR * szStockFont;
- // }
- //
- // stockfont[] = { OEM_FIXED_FONT, (TCHAR*)"OEM_FIXED_FONT",
- // ANSI_FIXED_FONT, (TCHAR*)"ANSI_FIXED_FONT",
- // ANSI_VAR_FONT, (TCHAR*)"ANSI_VAR_FONT",
- // SYSTEM_FONT, (TCHAR*)"SYSTEM_FONT",
- // DEVICE_DEFAULT_FONT, (TCHAR*)"DEVICE_DEFAULT_FONT",
- // SYSTEM_FIXED_FONT, (TCHAR*)"SYSTEM_FIXED_FONT",
- // DEFAULT_GUI_FONT, (TCHAR*)"DEFAULT_GUI_FONT" };
- //
- // static int iFont, cFonts = sizeof(stockfont) / sizeof(stockfont[0]);
- // HDC hdc;
- // int i, x, y, cxGrid, cyGrid;
- // PAINTSTRUCT ps;
- // TCHAR szFaceName[LF_FACESIZE], szBuffer[LF_FACESIZE + 64];
- // TEXTMETRIC tm;
- //
- // switch (message)
- // {
- // case WM_CREATE:
- // SetScrollRange(hwnd, SB_VERT, 0, cFonts - 1, TRUE);
- // return 0;
- //
- // case WM_DISPLAYCHANGE:
- // InvalidateRect(hwnd, NULL, TRUE);
- // return 0;
- //
- // case WM_VSCROLL:
- // switch (LOWORD(wParam))
- // {
- // case SB_TOP: iFont = 0; break;
- // case SB_BOTTOM: iFont = cFonts - 1; break;
- // case SB_LINEUP:
- // case SB_PAGEUP: iFont -= 1; break;
- // case SB_LINEDOWN:
- // case SB_PAGEDOWN: iFont += 1; break;
- // case SB_THUMBPOSITION: iFont = HIWORD(wParam); break;
- // }
- // iFont = max(0, min(cFonts - 1, iFont));
- // SetScrollPos(hwnd, SB_VERT, iFont, TRUE);
- // InvalidateRect(hwnd, NULL, TRUE);
- // return 0;
- //
- // case WM_KEYDOWN:
- // switch (wParam)
- // {
- // case VK_HOME: SendMessage(hwnd, WM_VSCROLL, SB_TOP, 0); break;
- // case VK_END: SendMessage(hwnd, WM_VSCROLL, SB_BOTTOM, 0); break;
- // case VK_PRIOR:
- // case VK_LEFT:
- // case VK_UP: SendMessage(hwnd, WM_VSCROLL, SB_LINEUP, 0); break;
- // case VK_NEXT:
- // case VK_RIGHT:
- // case VK_DOWN: SendMessage(hwnd, WM_VSCROLL, SB_PAGEDOWN, 0); break;
- // }
- // return 0;
- //
- // case WM_PAINT:
- // hdc = BeginPaint(hwnd, &ps);
- // SelectObject(hdc, GetStockObject(stockfont[iFont].idStockFont));
- // GetTextFace(hdc, LF_FACESIZE, szFaceName);
- // GetTextMetrics(hdc, &tm);
- // cxGrid = max(3 * tm.tmAveCharWidth, 2 * tm.tmMaxCharWidth);
- // cyGrid = tm.tmHeight + 3;
- //
- // TextOut(hdc, 0, 0, szBuffer, wsprintf(szBuffer, TEXT("%s:Face Name = %s, CharSet = %i"), stockfont[iFont].szStockFont, szFaceName, tm.tmCharSet));
- // SetTextAlign(hdc, TA_TOP | TA_CENTER);
- //
- // for (i = 0; i < 17; i++)
- // {
- // MoveToEx(hdc, (i + 2) * cxGrid, 2 * cyGrid, NULL);
- // LineTo(hdc, (i + 2) * cxGrid, 19 * cyGrid);
- // MoveToEx(hdc, cxGrid, (i + 3) * cyGrid, NULL);
- // LineTo(hdc, 18 * cxGrid, (i + 3) * cyGrid);
- // }
- //
- //
- // for (i = 0; i < 16; i++)
- // {
- // TextOut(hdc, (2 * i + 5) * cxGrid / 2, 2 * cyGrid + 2, szBuffer,
- // wsprintf(szBuffer, TEXT("%X−"), i));
- // TextOut(hdc, 3 * cxGrid / 2, (i + 3) * cyGrid + 2, szBuffer,
- // wsprintf(szBuffer, TEXT("−%X"), i));
- // }
- //
- //
- // for (y = 0; y < 16; y++)
- // for (x = 0; x < 16; x++)
- // {
- // TextOut(hdc, (2 * x + 5) * cxGrid / 2,
- // (y + 3) * cyGrid + 2, szBuffer,
- // wsprintf(szBuffer, TEXT("%c"), 16 * x + y));
- // }
- //
- // EndPaint(hwnd, &ps);
- // return 0;
- //
- // case WM_DESTROY:
- // PostQuitMessage(0);
- // return 0;
- // }
- // return DefWindowProc(hwnd, message, wParam, lParam);
- //
- //}
- //KEWVIEW1
- //#include<Windows.h>
- //
- //LRESULT CALLBACK WndProc(HWND, UINT, WPARAM, LPARAM);
- //
- //int WINAPI WinMain(HINSTANCE hInstance, HINSTANCE hPrevInstance, PSTR szCmdLine, int iCmdShow)
- //{
- // static TCHAR szAppName[] = TEXT("KeyView1");
- // HWND hwnd;
- // MSG msg;
- // WNDCLASS wndclass;
- //
- // wndclass.style = CS_HREDRAW | CS_VREDRAW;
- // wndclass.lpfnWndProc = WndProc;
- // wndclass.cbClsExtra = 0;
- // wndclass.cbWndExtra = 0;
- // wndclass.hInstance = hInstance;
- // wndclass.hIcon = LoadIcon(NULL, IDI_APPLICATION);
- // wndclass.hCursor = LoadCursor(NULL, IDC_ARROW);
- // wndclass.hbrBackground = (HBRUSH)GetStockObject(WHITE_BRUSH);
- // wndclass.lpszMenuName = NULL;
- // wndclass.lpszClassName = szAppName;
- //
- // if (!RegisterClass(&wndclass))
- // {
- // MessageBox(NULL, TEXT("This program requires Windows NT!"), szAppName, MB_ICONERROR);
- // return 0;
- // }
- // hwnd = CreateWindow(szAppName, TEXT("Keyboard Message Viewer #1"), WS_OVERLAPPEDWINDOW, CW_USEDEFAULT, CW_USEDEFAULT, CW_USEDEFAULT, CW_USEDEFAULT, NULL, NULL, hInstance, NULL);
- // ShowWindow(hwnd, iCmdShow);
- // UpdateWindow(hwnd);
- //
- // while (GetMessage(&msg, NULL, 0, 0))
- // {
- // TranslateMessage(&msg);
- // DispatchMessage(&msg);
- // }
- // return msg.wParam;
- //
- //}
- //
- //LRESULT CALLBACK WndProc(HWND hwnd, UINT message, WPARAM wParam, LPARAM lParam)
- //{
- // static int cxClientMax, cyClientMax, cxClient, cyClient, cxChar, cyChar;
- // static int cLinesMax, cLines;
- // static PMSG pmsg;
- // static RECT rectScroll;
- // static TCHAR szTop[] = TEXT("Message Key Char") TEXT("Repeat Scan Ext ALT Prev Tran");
- // static TCHAR szUnd[] = TEXT("_______ ___ ____") TEXT("______ ____ ___ ___ ____ ____");
- //
- // static TCHAR * szFormat[2] = {
- // TEXT("%−13s %3d %−15s%c%6u %4d %3s %3s %4s %4s"),
- // TEXT("%−13s 0x%04X%1s%c %6u %4d %3s %3s %4s %4s") };
- // static TCHAR * szYes = TEXT("Yes");
- // static TCHAR * szNo = TEXT("No");
- // static TCHAR * szDown = TEXT("Down");
- // static TCHAR * szUp = TEXT("Up");
- //
- // static TCHAR * szMessage[] = {
- // TEXT("WM_KEYDOWN"), TEXT("WM_KEYUP"),
- // TEXT("WM_CHAR"), TEXT("WM_DEADCHAR"),
- // TEXT("WM_SYSKEYDOWN"), TEXT("WM_SYSKEYUP"),
- // TEXT("WM_SYSCHAR"), TEXT("WM_SYSDEADCHAR") };
- //
- // HDC hdc;
- // int i, iType;
- // PAINTSTRUCT ps;
- // TCHAR szBuffer[128], szKeyName[32];
- // TEXTMETRIC tm;
- //
- // switch (message)
- // {
- // case WM_CREATE:
- // case WM_DISPLAYCHANGE:
- // cxClientMax = GetSystemMetrics(SM_CXMAXIMIZED);
- // cyClientMax = GetSystemMetrics(SM_CYMAXIMIZED);
- //
- // hdc = GetDC(hwnd);
- // SelectObject(hdc, GetStockObject(SYSTEM_FIXED_FONT));
- // GetTextMetrics(hdc, &tm);
- // cxChar = tm.tmAveCharWidth;
- // cyChar = tm.tmHeight;
- // ReleaseDC(hwnd, hdc);
- //
- // if (pmsg) free(pmsg);
- // cLinesMax = cyClientMax / cyChar;
- // pmsg = (PMSG)malloc(cLinesMax * sizeof(MSG));
- // cLines = 0;
- //
- // case WM_SIZE:
- // if (message == WM_SIZE)
- // {
- // cxClient = LOWORD(lParam);
- // cyClient = HIWORD(lParam);
- // }
- //
- // rectScroll.left = 0;
- // rectScroll.right = cxClient;
- // rectScroll.top = cyChar;
- // rectScroll.bottom = cyChar * (cyClient / cyChar);
- // InvalidateRect(hwnd, NULL, TRUE);
- // return 0;
- //
- // case WM_KEYDOWN:
- // case WM_KEYUP:
- // case WM_CHAR:
- // case WM_DEADCHAR:
- // case WM_SYSKEYDOWN:
- // case WM_SYSKEYUP:
- // case WM_SYSCHAR:
- // case WM_SYSDEADCHAR:
- // for (i = cLinesMax - 1; i > 0; i--)
- // {
- // pmsg[i] = pmsg[i - 1];
- // }
- // pmsg[0].hwnd = hwnd;
- // pmsg[0].message = message;
- // pmsg[0].wParam = wParam;
- // pmsg[0].lParam = lParam;
- //
- // cLines = min(cLines + 1, cLinesMax);
- // ScrollWindow(hwnd, 0, -cyChar, &rectScroll, &rectScroll);
- // break;
- //
- // case WM_PAINT:
- // hdc = BeginPaint(hwnd, &ps);
- // SelectObject(hdc, GetStockObject(SYSTEM_FIXED_FONT));
- // SetBkMode(hdc, TRANSPARENT);
- // TextOut(hdc, 0, 0, szTop, lstrlen(szTop));
- // TextOut(hdc, 0, 0, szUnd, lstrlen(szUnd));
- //
- // for (i = 0; i < min(cLines, cyClient / cyChar - 1); i++)
- // {
- // iType = pmsg[i].message == WM_CHAR || pmsg[i].message == WM_SYSCHAR ||
- // pmsg[i].message == WM_DEADCHAR ||
- // pmsg[i].message == WM_SYSDEADCHAR;
- //
- // GetKeyNameText(pmsg[i].lParam, szKeyName, sizeof(szKeyName) / sizeof(TCHAR));
- //
- // TextOut(hdc, 0, (cyClient / cyChar - 1 - i) * cyChar, szBuffer, wsprintf(szBuffer, szFormat[iType],
- // szMessage[pmsg[i].message - WM_KEYFIRST],
- // pmsg[i].wParam,
- // (PTSTR)(iType ? TEXT(" ") : szKeyName),
- // (TCHAR)(iType ? pmsg[i].wParam : ' '),
- // LOWORD(pmsg[i].lParam),
- // HIWORD(pmsg[i].lParam) & 0xFF,
- // 0x01000000 & pmsg[i].lParam ? szYes : szNo,
- // 0x20000000 & pmsg[i].lParam ? szYes : szNo,
- // 0x40000000 & pmsg[i].lParam ? szDown : szUp,
- // 0x80000000 & pmsg[i].lParam ? szUp : szDown));
- // }
- // EndPaint(hwnd, &ps);
- // return 0;
- //
- // case WM_DESTROY:
- // PostQuitMessage(0);
- // return 0;
- // }
- // return DefWindowProc(hwnd, message, wParam, lParam);
- //
- //}
- //SYSMETS4
- //#include<Windows.h>
- //#include "SYSMETS.h"
- //
- //LRESULT CALLBACK WndProc(HWND, UINT, WPARAM, LPARAM);
- //
- //int WINAPI WinMain(HINSTANCE hInstance, HINSTANCE hPrevInstance, PSTR szCmdLine, int iCmdShow)
- //{
- // static TCHAR szAppName[] = TEXT("SysMets4");
- // HWND hwnd;
- // MSG msg;
- // WNDCLASS wndclass;
- //
- // wndclass.style = CS_HREDRAW || CS_VREDRAW;
- // wndclass.lpfnWndProc = WndProc;
- // wndclass.cbClsExtra = 0;
- // wndclass.cbWndExtra = 0;
- // wndclass.hInstance = hInstance;
- // wndclass.hIcon = LoadIcon(NULL, IDI_APPLICATION);
- // wndclass.hCursor = LoadCursor(NULL, IDC_ARROW);
- // wndclass.hbrBackground = (HBRUSH)GetStockObject(WHITE_BRUSH);
- // wndclass.lpszMenuName = NULL;
- // wndclass.lpszClassName = szAppName;
- //
- // if (!RegisterClass(&wndclass))
- // {
- // MessageBox(NULL, TEXT("Program requires Windows NT!"), szAppName, MB_ICONERROR);
- // return 0;
- // }
- //
- // hwnd = CreateWindow(szAppName, TEXT("Get System Metrics No.4"), WS_OVERLAPPEDWINDOW | WS_VSCROLL | WS_HSCROLL, CW_USEDEFAULT, CW_USEDEFAULT, CW_USEDEFAULT, CW_USEDEFAULT, NULL, NULL, hInstance, NULL);
- // ShowWindow(hwnd, iCmdShow);
- // UpdateWindow(hwnd);
- //
- // while (GetMessage(&msg, NULL, 0, 0))
- // {
- // TranslateMessage(&msg);
- // DispatchMessage(&msg);
- // }
- // return msg.wParam;
- //
- //}
- //
- //LRESULT CALLBACK WndProc(HWND hwnd, UINT message, WPARAM wParam, LPARAM lParam)
- //{
- // static int cxChar, cxCaps, cyChar, cxClient, cyClient, iMaxWidth;
- // HDC hdc;
- // int i, x, y, iVertPos, iHorzPos, iPaintBeg, iPaintEnd;
- // PAINTSTRUCT ps;
- // SCROLLINFO si;
- // TCHAR szBuffer[10];
- // TEXTMETRIC tm;
- //
- // switch (message)
- // {
- // case WM_CREATE:
- // hdc = GetDC(hwnd);
- // GetTextMetrics(hdc, &tm);
- // cxChar = tm.tmAveCharWidth;
- // cxCaps = (tm.tmPitchAndFamily & 1 ? 3 : 2) * cxChar / 2;
- // cyChar = tm.tmHeight + tm.tmExternalLeading;
- //
- // ReleaseDC(hwnd, hdc);
- // iMaxWidth = 40 * cxChar + 22 * cxCaps;
- // return 0;
- //
- // case WM_SIZE:
- // cxClient = LOWORD(lParam);
- // cyClient = HIWORD(lParam);
- //
- // si.cbSize = sizeof(si);
- // si.fMask = SIF_RANGE | SIF_PAGE;
- // si.nMin = 0;
- // si.nMax = NUMLINES - 1;
- // si.nPage = cyClient / cyChar;
- //
- // SetScrollInfo(hwnd, SB_VERT, &si, TRUE);
- // return 0;
- //
- // case WM_VSCROLL:
- // si.cbSize = sizeof(si);
- // si.fMask = SIF_ALL;
- // GetScrollInfo(hwnd, SB_VERT, &si);
- //
- // iVertPos = si.nPos;
- //
- // switch (LOWORD(wParam))
- // {
- // case SB_TOP:
- // si.nPos = si.nMin;
- // break;
- //
- // case SB_BOTTOM:
- // si.nPos = si.nMax;
- // break;
- //
- // case SB_LINEUP:
- // si.nPos -= 1;
- // break;
- //
- // case SB_PAGEUP:
- // si.nPos -= si.nPage;
- // break;
- //
- // case SB_PAGEDOWN:
- // si.nPos += si.nPage;
- // break;
- //
- // case SB_THUMBTRACK:
- // si.nPos = si.nTrackPos;
- // break;
- //
- // default:
- // break;
- // }
- //
- // si.fMask = SIF_POS;
- // SetScrollInfo(hwnd, SB_VERT, &si, TRUE);
- // GetScrollInfo(hwnd, SB_VERT, &si);
- //
- // if (si.nPos != iVertPos)
- // {
- // ScrollWindow(hwnd, 0, cyChar * (iVertPos - si.nPos), NULL, NULL);
- // UpdateWindow(hwnd);
- // }
- // return 0;
- //
- // case WM_HSCROLL:
- // si.cbSize = sizeof(si);
- // si.fMask = SIF_ALL;
- // GetScrollInfo(hwnd, SB_HORZ, &si);
- // iHorzPos = si.nPos;
- //
- // switch (LOWORD(wParam))
- // {
- // case SB_LINELEFT:
- // si.nPos -= 1;
- // break;
- //
- // case SB_LINERIGHT:
- // si.nPos += 1;
- // break;
- //
- // case SB_PAGELEFT:
- // si.nPos -= si.nPage;
- // break;
- //
- // case SB_PAGERIGHT:
- // si.nPos += si.nPage;
- // break;
- //
- // case SB_THUMBPOSITION:
- // si.nPos = si.nTrackPos;
- // break;
- //
- // default:
- // break;
- //
- // }
- //
- // si.fMask = SIF_POS;
- // SetScrollInfo(hwnd, SB_HORZ, &si, TRUE);
- // GetScrollInfo(hwnd, SB_HORZ, &si);
- //
- // if (si.nPos != iHorzPos)
- // {
- // ScrollWindow(hwnd, cxChar * (iHorzPos - si.nPos), 0, NULL, NULL);
- // }
- // return 0;
- //
- // case WM_KEYDOWN:
- // switch (wParam)
- // {
- // case VK_HOME:
- // SendMessage(hwnd, WM_HSCROLL, SB_TOP, 0);
- // break;
- //
- // case VK_END:
- // SendMessage(hwnd, WM_VSCROLL, SB_BOTTOM, 0);
- // break;
- //
- // case VK_PRIOR:
- // SendMessage(hwnd, WM_VSCROLL, SB_PAGEUP, 0);
- // break;
- //
- // case VK_NEXT:
- // SendMessage(hwnd, WM_VSCROLL, SB_PAGEDOWN, 0);
- // break;
- //
- // case VK_UP:
- // SendMessage(hwnd, WM_VSCROLL, SB_LINEUP, 0);
- // break;
- //
- // case VK_DOWN:
- // SendMessage(hwnd, WM_VSCROLL, SB_LINEDOWN, 0);
- // break;
- //
- // case VK_LEFT:
- // SendMessage(hwnd, WM_HSCROLL, SB_PAGEUP, 0);
- // break;
- //
- // case VK_RIGHT:
- // SendMessage(hwnd, WM_HSCROLL, SB_PAGEDOWN, 0);
- // break;
- // }
- // return 0;
- //
- // case WM_PAINT:
- // hdc = BeginPaint(hwnd, &ps);
- // si.cbSize = sizeof(si);
- // si.fMask = SIF_POS;
- // GetScrollInfo(hwnd, SB_VERT, &si);
- // iVertPos = si.nPos;
- // GetScrollInfo(hwnd, SB_HORZ, &si);
- // iHorzPos = si.nPos;
- // iPaintBeg = max(0, iVertPos + ps.rcPaint.top / cyChar);
- // iPaintEnd = min(NUMLINES - 1, iVertPos + ps.rcPaint.bottom / cyChar);
- //
- // for (i = iPaintBeg; i < iPaintEnd; i++)
- // {
- // x = cxChar * (1 - iHorzPos);
- // y = cyChar * (i - iVertPos);
- //
- // TextOut(hdc, x, y, sysmetrics[i].szLabel, lstrlen(sysmetrics[i].szLabel));
- // TextOut(hdc, x + 22 * cxCaps, y, sysmetrics[i].szDesc, lstrlen(sysmetrics[i].szDesc));
- // SetTextAlign(hdc, TA_RIGHT | TA_TOP);
- // TextOut(hdc, x + 22 * cxCaps + 40 * cxChar, y, szBuffer, wsprintf(szBuffer, TEXT("%5d"), GetSystemMetrics(sysmetrics[i].iIndex)));
- // SetTextAlign(hdc, TA_LEFT | TA_TOP);
- // }
- // EndPaint(hwnd, &ps);
- // return 0;
- //
- // case WM_DESTROY:
- // PostQuitMessage(0);
- // return 0;
- // }
- // return DefWindowProc(hwnd, message, wParam, lParam);
- //
- //}
- //CLOVER
- //#include<windows.h>
- //#include<math.h>
- //
- //#define TWO_PI (2.0 * 3.14159)
- //
- //LRESULT CALLBACK WndProc(HWND, UINT, WPARAM, LPARAM);
- //
- //int WINAPI WinMain(HINSTANCE hInstance, HINSTANCE hPrevInstance, PSTR szCmdLine, int iCmdShow)
- //{
- // static TCHAR szAppName[] = TEXT("Clover");
- // HWND hwnd;
- // MSG msg;
- // WNDCLASS wndclass;
- //
- // wndclass.style = CS_HREDRAW | CS_VREDRAW;
- // wndclass.lpfnWndProc = WndProc;
- // wndclass.cbClsExtra = 0;
- // wndclass.cbWndExtra = 0;
- // wndclass.hInstance = hInstance;
- // wndclass.hIcon = LoadIcon(NULL, IDI_APPLICATION);
- // wndclass.hCursor = LoadCursor(NULL, IDC_ARROW);
- // wndclass.hbrBackground = (HBRUSH)GetStockObject(WHITE_BRUSH);
- // wndclass.lpszMenuName = NULL;
- // wndclass.lpszClassName = szAppName;
- //
- // if (!RegisterClass(&wndclass))
- // {
- // MessageBox(NULL, TEXT("This program requires Windows NT!"), szAppName, MB_ICONERROR);
- // return 0;
- // }
- //
- // hwnd = CreateWindow(szAppName, TEXT("Draw a Clover"), WS_OVERLAPPEDWINDOW, CW_USEDEFAULT, CW_USEDEFAULT, CW_USEDEFAULT, CW_USEDEFAULT, NULL, NULL, hInstance, NULL);
- // ShowWindow(hwnd, iCmdShow);
- // UpdateWindow(hwnd);
- //
- // while (GetMessage(&msg, NULL, 0, 0))
- // {
- // TranslateMessage(&msg);
- // DispatchMessage(&msg);
- // }
- // return msg.wParam;
- //
- //}
- //
- //LRESULT CALLBACK WndProc(HWND hwnd, UINT iMsg, WPARAM wParam, LPARAM lParam)
- //{
- // static HRGN hRgnClip;
- // static int cxClient, cyClient;
- // double fAngle, fRadius;
- // HCURSOR hCursor;
- // HDC hdc;
- // HRGN hRgnTemp[6];
- // int i;
- // PAINTSTRUCT ps;
- //
- // switch (iMsg)
- // {
- // case WM_SIZE:
- // cxClient = LOWORD(lParam);
- // cyClient = HIWORD(lParam);
- // hCursor = SetCursor(LoadCursor(NULL, IDC_WAIT));
- // ShowCursor(TRUE);
- //
- // if (hRgnClip) DeleteObject(hRgnClip);
- // hRgnTemp[0] = CreateEllipticRgn(0, cyClient / 3, cxClient / 2, 2 * cyClient / 3);
- // hRgnTemp[1] = CreateEllipticRgn(cxClient / 2, cyClient / 3, cxClient, 2 * cyClient / 3);
- // hRgnTemp[2] = CreateEllipticRgn(cxClient / 3, 0, 2 * cxClient / 3, cyClient / 2);
- // hRgnTemp[3] = CreateEllipticRgn(cxClient / 3, cyClient / 2, 2 * cxClient / 3, cyClient);
- //
- // hRgnTemp[4] = CreateRectRgn(0, 0, 1, 1);
- // hRgnTemp[5] = CreateRectRgn(0, 0, 1, 1);
- // hRgnClip = CreateRectRgn(0, 0, 1, 1);
- //
- // CombineRgn(hRgnTemp[4], hRgnTemp[0], hRgnTemp[1], RGN_OR);
- // CombineRgn(hRgnTemp[5], hRgnTemp[2], hRgnTemp[3], RGN_OR);
- // CombineRgn(hRgnClip, hRgnTemp[4], hRgnTemp[5], RGN_XOR);
- //
- // for (i = 0; i < 6; i++)
- // {
- // DeleteObject(hRgnTemp[i]);
- // }
- // SetCursor(hCursor);
- // ShowCursor(FALSE);
- // return 0;
- //
- // case WM_PAINT:
- // hdc = BeginPaint(hwnd, &ps);
- // SetViewportOrgEx(hdc, cxClient / 2, cyClient / 2, NULL);
- // SelectClipRgn(hdc, hRgnClip);
- // fRadius = _hypot(cxClient / 2.0, cyClient / 2.0);
- // for (fAngle = 0.0; fAngle < TWO_PI; fAngle += TWO_PI / 360);
- // {
- // MoveToEx(hdc, 0, 0, NULL);
- // LineTo(hdc, (int) (fRadius * cos(fAngle) + 0.5), (int) (-fRadius * sin(fAngle) + 0.5));
- // }
- // EndPaint(hwnd, &ps);
- // return 0;
- //
- // case WM_DESTROY:
- // DeleteObject(hRgnClip);
- // PostQuitMessage(0);
- // return 0;
- //
- // }
- //
- // return DefWindowProc(hwnd, iMsg, wParam, lParam);
- //
- //}
- //RANDRECT
- //#include<Windows.h>
- //#include<stdlib.h>
- //
- //LRESULT CALLBACK WndProc(HWND, UINT, WPARAM, LPARAM);
- //void DrawRectangle(HWND);
- //
- //int cxClient, cyClient;
- //
- //int WINAPI WinMain(HINSTANCE hInstance, HINSTANCE hPrevInstance, PSTR szCmdLine, int iCmdShow)
- //{
- // static TCHAR szAppname[] = TEXT("RandRect");
- // HWND hwnd;
- // MSG msg;
- // WNDCLASS wndclass;
- //
- // wndclass.style = CS_HREDRAW | CS_VREDRAW;
- // wndclass.lpfnWndProc = WndProc;
- // wndclass.cbClsExtra = 0;
- // wndclass.cbWndExtra = 0;
- // wndclass.hInstance = hInstance;
- // wndclass.hIcon = LoadIcon(NULL, IDI_APPLICATION);
- // wndclass.hCursor = LoadCursor(NULL, IDC_ARROW);
- // wndclass.hbrBackground = (HBRUSH)GetStockObject(WHITE_BRUSH);
- // wndclass.lpszMenuName = NULL;
- // wndclass.lpszClassName = szAppname;
- //
- // if (!RegisterClass(&wndclass))
- // {
- // MessageBox(NULL, TEXT("This program requires Windows NT!"), szAppname, MB_ICONERROR);
- // return 0;
- // }
- //
- // hwnd = CreateWindow(szAppname, TEXT("Random Rectangles"), WS_OVERLAPPEDWINDOW, CW_USEDEFAULT, CW_USEDEFAULT, CW_USEDEFAULT, CW_USEDEFAULT, NULL, NULL, hInstance, NULL);
- // ShowWindow(hwnd, iCmdShow);
- // UpdateWindow(hwnd);
- //
- // while (TRUE)
- // {
- // if (PeekMessage(&msg, NULL, 0, 0, PM_REMOVE))
- // {
- // if (msg.message == WM_QUIT)
- // {
- // break;
- // }
- // TranslateMessage(&msg);
- // DispatchMessage(&msg);
- // }
- // else
- // {
- // DrawRectangle(hwnd);
- // }
- // return msg.wParam;
- // }
- //}
- //
- //LRESULT CALLBACK WndProc(HWND hwnd, UINT iMsg, WPARAM wParam, LPARAM lParam)
- //{
- // switch (iMsg)
- // {
- // case WM_SIZE:
- // cxClient = LOWORD(lParam);
- // cyClient = HIWORD(lParam);
- // return 0;
- //
- // case WM_DESTROY:
- // PostQuitMessage(0);
- // return 0;
- // }
- // return DefWindowProc(hwnd, iMsg, wParam, lParam);
- //
- //}
- //
- //void DrawRectangle(HWND hwnd)
- //{
- // HBRUSH hBrush;
- // HDC hdc;
- // RECT rect;
- //
- // if (cxClient == 0 || cyClient == 0) return ;
- // SetRect(&rect, rand() % cxClient, rand() % cyClient, rand() % cxClient, rand() % cyClient);
- // hBrush = CreateSolidBrush(RGB(rand() % 256, rand() % 256, rand() % 256));
- // hdc = GetDC(hwnd);
- // FillRect(hdc, &rect, hBrush);
- // ReleaseDC(hwnd, hdc);
- // DeleteObject(hBrush);
- //}
- //WHATSIZE
- //#include<Windows.h>
- //
- //LRESULT CALLBACK WndProc(HWND, UINT, WPARAM, LPARAM);
- //
- //int WINAPI WinMain(HINSTANCE hInstance, HINSTANCE hPrevInstance, PSTR szCmdLine, int iCmdShow)
- //{
- // static TCHAR szAppName[] = TEXT("WhatSize");
- // HWND hwnd;
- // MSG msg;
- // WNDCLASS wndclass;
- //
- // wndclass.style = CS_HREDRAW | CS_VREDRAW;
- // wndclass.lpfnWndProc = WndProc;
- // wndclass.cbClsExtra = 0;
- // wndclass.cbWndExtra = 0;
- // wndclass.hInstance = hInstance;
- // wndclass.hIcon = LoadIcon(NULL, IDI_APPLICATION);
- // wndclass.hCursor = LoadCursor(NULL, IDC_ARROW);
- // wndclass.hbrBackground = (HBRUSH)GetStockObject(WHITE_BRUSH);
- // wndclass.lpszMenuName = NULL;
- // wndclass.lpszClassName = szAppName;
- //
- // if (!RegisterClass(&wndclass))
- // {
- // MessageBox(NULL, TEXT("This program requires Windows NT!"), szAppName, MB_ICONERROR);
- // return 0;
- // }
- //
- // hwnd = CreateWindow(szAppName, TEXT("What Size is the Window?"), WS_OVERLAPPEDWINDOW, CW_USEDEFAULT, CW_USEDEFAULT, CW_USEDEFAULT, CW_USEDEFAULT, NULL, NULL, hInstance, NULL);
- // ShowWindow(hwnd, iCmdShow);
- // UpdateWindow(hwnd);
- //
- // while (GetMessage(&msg, NULL, 0, 0))
- // {
- // TranslateMessage(&msg);
- // DispatchMessage(&msg);
- // }
- // return msg.wParam;
- //
- //}
- //
- //void Show(HWND hwnd, HDC hdc, int xText, int yText, int iMapMode, TCHAR * szMapMode)
- //{
- // TCHAR szBuffer[60];
- // RECT rect;
- //
- // SaveDC(hdc);
- // SetMapMode(hdc, iMapMode);
- // GetClientRect(hwnd, &rect);
- // DPtoLP(hdc, (PPOINT) &rect, 2);
- //
- // RestoreDC(hdc, -1);
- // TextOut(hdc, xText, yText, szBuffer, wsprintf(szBuffer, TEXT("%-20s %7d %7d %7d %7d"), szMapMode, rect.left, rect.right, rect.top, rect.bottom));
- //
- //}
- //
- //
- //LRESULT CALLBACK WndProc(HWND hwnd, UINT message, WPARAM wParam, LPARAM lParam)
- //{
- // static TCHAR szHeading[] = TEXT("MappingMode LEFT RIGHT TOP BOTTOM");
- // static TCHAR szUndLine[] = TEXT("----------- ---- ----- --- ------");
- // static int cxChar, cyChar;
- // HDC hdc;
- // PAINTSTRUCT ps;
- // TEXTMETRIC tm;
- //
- // switch (message)
- // {
- // case WM_CREATE:
- // hdc = GetDC(hwnd);
- // SelectObject(hdc, GetStockObject(SYSTEM_FIXED_FONT));
- // GetTextMetrics(hdc, &tm);
- // cxChar = tm.tmAveCharWidth;
- // cyChar = tm.tmHeight + tm.tmExternalLeading;
- // ReleaseDC(hwnd, hdc);
- // return 0;
- //
- // case WM_PAINT:
- // hdc = BeginPaint(hwnd, &ps);
- // SelectObject(hdc, GetStockObject(SYSTEM_FIXED_FONT));
- // SetMapMode(hdc, MM_ANISOTROPIC);
- // SetWindowExtEx(hdc, 1, 1, NULL);
- // SetViewportExtEx(hdc, cxChar, cyChar, NULL);
- // TextOut(hdc, 1, 1, szHeading, lstrlen(szHeading));
- // TextOut(hdc, 1, 2, szUndLine, lstrlen(szUndLine));
- //
- // Show(hwnd, hdc, 1, 3, MM_TEXT, TEXT("TEXT(pixels)"));
- // Show(hwnd, hdc, 1, 4, MM_LOMETRIC, TEXT("LOMETRIC(.1mm)"));
- // Show(hwnd, hdc, 1, 5, MM_HIMETRIC, TEXT("HIMETRIC(.01 mm)"));
- // Show(hwnd, hdc, 1, 6, MM_LOENGLISH, TEXT("LOENGLISH(.01 in)"));
- // Show(hwnd, hdc, 1, 7, MM_HIENGLISH, TEXT("HIENGLISH(.001 in)"));
- // Show(hwnd, hdc, 1, 8, MM_TWIPS, TEXT("TWIPS(1/1440 in)"));
- //
- // EndPaint(hwnd, &ps);
- // return 0;
- //
- // case WM_DESTROY:
- // PostQuitMessage(0);
- // return 0;
- // }
- // return DefWindowProc(hwnd, message, wParam, lParam);
- //
- //}
- //ALTWIND
- //#include<Windows.h>
- //
- //LRESULT CALLBACK WndProc(HWND, UINT, WPARAM, LPARAM);
- //
- //int WINAPI WinMain(HINSTANCE hInstance, HINSTANCE hPrevInstance, PSTR szCmdLine, int iCmdShow)
- //{
- // static TCHAR szAppName[] = TEXT("AltWind");
- // HWND hwnd;
- // MSG msg;
- // WNDCLASS wndclass;
- //
- // wndclass.style = CS_HREDRAW | CS_VREDRAW;
- // wndclass.lpfnWndProc = WndProc;
- // wndclass.cbClsExtra = 0;
- // wndclass.cbWndExtra = 0;
- // wndclass.hInstance = hInstance;
- // wndclass.hIcon = LoadIcon(NULL, IDI_APPLICATION);
- // wndclass.hCursor = LoadCursor(NULL, IDC_ARROW);
- // wndclass.hbrBackground = (HBRUSH)GetStockObject(WHITE_BRUSH);
- // wndclass.lpszMenuName = NULL;
- // wndclass.lpszClassName = szAppName;
- //
- // if (!RegisterClass(&wndclass))
- // {
- // MessageBox(NULL, TEXT("Program requires Windows NT!"), szAppName, MB_ICONERROR);
- // return 0;
- // }
- //
- // hwnd = CreateWindow(szAppName, TEXT("Alternate and Winding Fill Modes"), WS_OVERLAPPEDWINDOW, CW_USEDEFAULT, CW_USEDEFAULT, CW_USEDEFAULT, CW_USEDEFAULT, NULL, NULL, hInstance, NULL);
- // ShowWindow(hwnd, iCmdShow);
- // UpdateWindow(hwnd);
- //
- // while (GetMessage(&msg, NULL, 0, 0))
- // {
- // TranslateMessage(&msg);
- // DispatchMessage(&msg);
- // }
- // return msg.wParam;
- //
- //}
- //
- //LRESULT CALLBACK WndProc(HWND hwnd, UINT message, WPARAM wParam, LPARAM lParam)
- //{
- // static POINT aptFigure[10] = { 10, 70, 50, 70, 50, 10, 90, 10, 90, 50, 30, 50, 30, 90, 70, 90, 70, 30, 10, 30 };
- // static int cxClient, cyClient;
- // HDC hdc;
- // int i;
- // PAINTSTRUCT ps;
- // POINT apt[10];
- //
- // switch (message)
- // {
- // case WM_SIZE:
- // cxClient = LOWORD(lParam);
- // cyClient = HIWORD(lParam);
- // case WM_PAINT:
- // hdc = BeginPaint(hwnd, &ps);
- // SelectObject(hdc, GetStockObject(GRAY_BRUSH));
- // for (i = 0; i < 10; i++)
- // {
- // apt[i].x = cxClient * aptFigure[i].x / 200;
- // apt[i].y = cyClient * aptFigure[i].y / 100;
- // }
- // SetPolyFillMode(hdc, ALTERNATE);
- // Polygon(hdc, apt, 10);
- // for (i = 0; i < 10; i++)
- // {
- // apt[i].x += cxClient / 2;
- // }
- // SetPolyFillMode(hdc, WINDING);
- // Polygon(hdc, apt, 10);
- // EndPaint(hwnd, &ps);
- // return 0;
- // case WM_DESTROY:
- // PostQuitMessage(0);
- // return 0;
- // }
- //
- //
- // return DefWindowProc(hwnd, message, wParam, lParam);
- //}
- //BEZIER
- //#include<Windows.h>
- //
- //LRESULT CALLBACK WndProc(HWND, UINT, WPARAM, LPARAM);
- //
- //int WINAPI WinMain(HINSTANCE hInstance, HINSTANCE hPrevInstance, PSTR szCmdLine, int iCmdShow)
- //{
- // static TCHAR szAppName[] = TEXT("Bezier");
- // HWND hwnd;
- // MSG msg;
- // WNDCLASS wndclass;
- // wndclass.style = CS_HREDRAW | CS_VREDRAW;
- // wndclass.lpfnWndProc = WndProc;
- // wndclass.cbClsExtra = 0;
- // wndclass.cbWndExtra = 0;
- // wndclass.hInstance = hInstance;
- // wndclass.hIcon = LoadIcon(NULL, IDI_APPLICATION);
- // wndclass.hCursor = LoadCursor(NULL, IDC_ARROW);
- // wndclass.hbrBackground = (HBRUSH)GetStockObject(WHITE_BRUSH);
- // wndclass.lpszMenuName = NULL;
- // wndclass.lpszClassName = szAppName;
- //
- //
- // if (!RegisterClass(&wndclass))
- // {
- // MessageBox(NULL, TEXT("Program requires Windows NT!"), szAppName, MB_ICONERROR);
- // return 0;
- // }
- //
- // hwnd = CreateWindow(szAppName, TEXT("Bezier Splines"), WS_OVERLAPPEDWINDOW, CW_USEDEFAULT, CW_USEDEFAULT, CW_USEDEFAULT, CW_USEDEFAULT, NULL, NULL, hInstance, NULL);
- // ShowWindow(hwnd, iCmdShow);
- // UpdateWindow(hwnd);
- //
- // while (GetMessage(&msg, NULL, 0, 0))
- // {
- // TranslateMessage(&msg);
- // DispatchMessage(&msg);
- // }
- //
- // return msg.wParam;
- //}
- //
- //void DrawBezier(HDC hdc, POINT apt[])
- //{
- // PolyBezier(hdc, apt, 4);
- // MoveToEx(hdc, apt[0].x, apt[0].y, NULL);
- // LineTo(hdc, apt[1].x, apt[1].y);
- // MoveToEx(hdc, apt[2].x, apt[2].y, NULL);
- // LineTo(hdc, apt[3].x, apt[3].y);
- //}
- //
- //LRESULT CALLBACK WndProc(HWND hwnd, UINT message, WPARAM wParam, LPARAM lParam)
- //{
- // static POINT apt[4];
- // HDC hdc;
- // int cxClient, cyClient;
- // PAINTSTRUCT ps;
- //
- // switch (message)
- // {
- // case WM_SIZE:
- // cxClient = LOWORD(lParam);
- // cyClient = HIWORD(lParam);
- // apt[0].x = cxClient / 4;
- // apt[0].y = cyClient / 2;
- //
- // apt[1].x = cxClient / 2;
- // apt[1].y = cyClient / 4;
- //
- // apt[2].x = cxClient / 2;
- // apt[2].y = 3*cyClient / 4;
- //
- // apt[3].x = 3 * cxClient / 4;
- // apt[3].y = cyClient / 2;
- // return 0;
- //
- // case WM_LBUTTONDOWN:
- // case WM_RBUTTONDOWN:
- // case WM_MOUSEMOVE:
- // if (wParam & MK_LBUTTON || wParam & MK_RBUTTON)
- // {
- // hdc = GetDC(hwnd);
- // SelectObject(hdc, GetStockObject(WHITE_PEN));
- // DrawBezier(hdc, apt);
- // ReleaseDC(hwnd, hdc);
- // }
- // return 0;
- //
- // case WM_PAINT:
- // InvalidateRect(hwnd, NULL, TRUE);
- // hdc = BeginPaint(hwnd, &ps);
- // DrawBezier(hdc, apt);
- // EndPaint(hwnd, &ps);
- // return 0;
- //
- // case WM_DESTROY:
- // PostQuitMessage(0);
- // return 0;
- // }
- //
- // return DefWindowProc(hwnd, message, wParam, lParam);
- //}
- //LINEDEMO
- //#include<Windows.h>
- //
- //LRESULT CALLBACK WndProc(HWND, UINT, WPARAM, LPARAM);
- //
- //int WINAPI WinMain(HINSTANCE hInstance, HINSTANCE hPrevInstance, PSTR szCmdLine, int iCmdShow)
- //{
- // static TCHAR szAppName[] = TEXT("LineDemo");
- // HWND hwnd;
- // MSG msg;
- // WNDCLASS wndclass;
- //
- // wndclass.style = CS_HREDRAW | CS_VREDRAW;
- // wndclass.lpfnWndProc = WndProc;
- // wndclass.cbClsExtra = 0;
- // wndclass.cbWndExtra = 0;
- // wndclass.hInstance = hInstance;
- // wndclass.hIcon = LoadIcon(NULL, IDI_APPLICATION);
- // wndclass.hCursor = LoadCursor(NULL, IDC_ARROW);
- // wndclass.hbrBackground = (HBRUSH)GetStockObject(WHITE_BRUSH);
- // wndclass.lpszMenuName = NULL;
- // wndclass.lpszClassName = szAppName;
- //
- //
- // if (!RegisterClass(&wndclass))
- // {
- // MessageBox(NULL, TEXT("Program requires Windows NT!"), szAppName, MB_ICONERROR);
- // return 0;
- // }
- //
- // hwnd = CreateWindow(szAppName, TEXT("Line Demonstration"), WS_OVERLAPPEDWINDOW, CW_USEDEFAULT, CW_USEDEFAULT, CW_USEDEFAULT, CW_USEDEFAULT, NULL, NULL, hInstance, NULL);
- // ShowWindow(hwnd, iCmdShow);
- // UpdateWindow(hwnd);
- //
- // while (GetMessage(&msg, NULL, 0, 0))
- // {
- // TranslateMessage(&msg);
- // DispatchMessage(&msg);
- // }
- // return msg.wParam;
- //}
- //
- //LRESULT CALLBACK WndProc(HWND hwnd, UINT message, WPARAM wParam, LPARAM lParam)
- //{
- // static int cxClient, cyClient;
- // HDC hdc;
- // PAINTSTRUCT ps;
- //
- // switch (message)
- // {
- // case WM_SIZE:
- // cxClient = LOWORD(lParam);
- // cyClient = HIWORD(lParam);
- // return 0;
- // case WM_PAINT:
- // hdc = BeginPaint(hwnd, &ps);
- // Rectangle(hdc, cxClient / 8, cyClient / 8, 7 * cxClient / 8, 7 * cyClient / 8);
- // MoveToEx(hdc, 0, 0, NULL);
- // LineTo(hdc, cxClient, cyClient);
- // MoveToEx(hdc, 0, cyClient, NULL);
- // LineTo(hdc, cxClient, 0);
- // Ellipse(hdc, cxClient / 8, cyClient / 8, 7 * cxClient / 8, 7 * cyClient / 8);
- // RoundRect(hdc, cxClient / 4, cyClient / 4, 3 * cxClient / 4, 3 * cyClient / 4, cxClient / 4, cyClient / 4);
- // EndPaint(hwnd, &ps);
- // return 0;
- // case WM_DESTROY:
- // PostQuitMessage(0);
- // return 0;
- // }
- //
- // return DefWindowProc(hwnd, message, wParam, lParam);
- //}
- //SINEWAVE
- //#include<Windows.h>
- //#include<math.h>
- //
- //#define NUM 1000
- //#define TWOPI (2*3.14159)
- //
- //LRESULT CALLBACK WndProc(HWND, UINT, WPARAM, LPARAM);
- //
- //int WINAPI WinMain(HINSTANCE hInstance, HINSTANCE hPrevInstance, PSTR szCmdLine, int iCmdShow)
- //{
- // static TCHAR szAppName[] = TEXT("SineWave");
- // HWND hwnd;
- // MSG msg;
- // WNDCLASS wndclass;
- //
- // wndclass.style = CS_HREDRAW | CS_VREDRAW;
- // wndclass.lpfnWndProc = WndProc;
- // wndclass.cbClsExtra = 0;
- // wndclass.cbWndExtra = 0;
- // wndclass.hInstance = hInstance;
- // wndclass.hIcon = LoadIcon(NULL, IDI_APPLICATION);
- // wndclass.hCursor = LoadCursor(NULL, IDC_ARROW);
- // wndclass.hbrBackground = (HBRUSH)GetStockObject(WHITE_BRUSH);
- // wndclass.lpszMenuName = NULL;
- // wndclass.lpszClassName = szAppName;
- //
- // if (!RegisterClass(&wndclass))
- // {
- // MessageBox(NULL, TEXT("Program requires Windows NT!"), szAppName, MB_ICONERROR);
- // return 0;
- // }
- //
- // hwnd = CreateWindow(szAppName, TEXT("Sine Wave Using Polyline"), WS_OVERLAPPEDWINDOW, CW_USEDEFAULT, CW_USEDEFAULT, CW_USEDEFAULT, CW_USEDEFAULT, NULL, NULL, hInstance, NULL);
- // ShowWindow(hwnd, iCmdShow);
- // UpdateWindow(hwnd);
- //
- // while (GetMessage(&msg, NULL, 0, 0))
- // {
- // TranslateMessage(&msg);
- // DispatchMessage(&msg);
- // }
- // return msg.wParam;
- //
- //}
- //
- //LRESULT CALLBACK WndProc(HWND hwnd, UINT message, WPARAM wParam, LPARAM lParam)
- //{
- // static int cxClient, cyClient;
- // HDC hdc;
- // int i;
- // PAINTSTRUCT ps;
- // POINT apt[NUM];
- //
- // switch (message)
- // {
- // case WM_SIZE:
- // cxClient = LOWORD(lParam);
- // cyClient = HIWORD(lParam);
- // return 0;
- //
- // case WM_PAINT:
- // hdc = BeginPaint(hwnd, &ps);
- // MoveToEx(hdc, 0, cyClient / 2, NULL);
- // LineTo(hdc, cxClient, cyClient / 2);
- // for (i = 0; i < NUM; i++)
- // {
- // apt[i].x = i*cxClient / NUM;
- // apt[i].y = (int)(cyClient / 2 * (1 - sin(TWOPI*i / NUM)));
- // }
- // Polyline(hdc, apt, NUM);
- // return 0;
- //
- // case WM_DESTROY:
- // PostQuitMessage(0);
- // return 0;
- // }
- //
- // return DefWindowProc(hwnd, message, wParam, lParam);
- //}
- //DEVCAPS1
- //#include<windows.h>
- //#define NUMLINES (int)(sizeof devcaps / sizeof(devcaps[0]) )
- //
- //struct
- //{
- // int iIndex;
- // TCHAR * szLabel;
- // TCHAR * szDesc;
- //}
- //devcaps[] =
- //{
- // HORZSIZE, TEXT("HORZSIZE"), TEXT("Width in millimeters:"),
- // VERTSIZE, TEXT("VERTSIZE"), TEXT("Height in millimeters:"),
- // HORZRES, TEXT("HORZRES"), TEXT("Width in pixels:"),
- // VERTRES, TEXT("VERTRES"), TEXT("Height in raster lines:"),
- // BITSPIXEL, TEXT("BITSPIXEL"), TEXT("Color bits per pixel:"),
- // PLANES, TEXT("PLANES"), TEXT("Number of color planes:"),
- // NUMBRUSHES, TEXT("NUMBRUSHES"), TEXT("Number of device brushes:"),
- // NUMPENS, TEXT("NUMPENS"), TEXT("Number of device pens:"),
- // NUMMARKERS, TEXT("NUMMARKERS"), TEXT("Number of device markers:"),
- // NUMFONTS, TEXT("NUMFONTS"), TEXT("Number of device fonts:"),
- // NUMCOLORS, TEXT("NUMCOLORS"), TEXT("Number of device colors:"),
- // PDEVICESIZE, TEXT("PDEVICESIZE"), TEXT("Size of device structure:"),
- // ASPECTX, TEXT("ASPECTX"), TEXT("Relative width of pixel:"),
- // ASPECTY, TEXT("ASPECTY"), TEXT("Relative height of pixel:"),
- // ASPECTXY, TEXT("ASPECTXY"), TEXT("Relative diagonal of pixel:"),
- // LOGPIXELSX, TEXT("LOGPIXELSX"), TEXT("Horizontal dots per inch:"),
- // LOGPIXELSY, TEXT("LOGPIXELSY"), TEXT("Vertical dots per inch:"),
- // SIZEPALETTE, TEXT("SIZEPALETTE"), TEXT("Number of palette entries:"),
- // NUMRESERVED, TEXT("NUMRESERVED"), TEXT("Reserved palette entries:"),
- // COLORRES, TEXT("COLORRES"), TEXT("Actual color resolution:")
- //};
- //
- //LRESULT CALLBACK WndProc(HWND, UINT, WPARAM, LPARAM);
- //
- //int WINAPI WinMain(HINSTANCE hInstance, HINSTANCE hPrevInstance, PSTR szCmdLine, int iCmdShow)
- //{
- // static TCHAR szAppName[] = TEXT("DevCaps1");
- // HWND hwnd;
- // MSG msg;
- // WNDCLASS wndclass;
- //
- // wndclass.style = CS_HREDRAW | CS_VREDRAW;
- // wndclass.lpfnWndProc = WndProc;
- // wndclass.cbClsExtra = 0;
- // wndclass.cbWndExtra = 0;
- // wndclass.hInstance = hInstance;
- // wndclass.hIcon = LoadIcon(NULL, IDI_APPLICATION);
- // wndclass.hCursor = LoadCursor(NULL, IDC_ARROW);
- // wndclass.hbrBackground = (HBRUSH)GetStockObject(WHITE_BRUSH);
- // wndclass.lpszMenuName = NULL;
- // wndclass.lpszClassName = szAppName;
- //
- // if (!RegisterClass(&wndclass))
- // {
- // MessageBox(NULL, TEXT("This program reuqires Windows NT!"), szAppName, MB_ICONERROR);
- // return 0;
- // }
- //
- // hwnd = CreateWindow(szAppName, TEXT("Device Capabilities"), WS_OVERLAPPEDWINDOW, CW_USEDEFAULT, CW_USEDEFAULT, CW_USEDEFAULT, CW_USEDEFAULT, NULL, NULL, hInstance, NULL);
- // ShowWindow(hwnd, iCmdShow);
- // UpdateWindow(hwnd);
- //
- // while (GetMessage(&msg, NULL, 0, 0))
- // {
- // TranslateMessage(&msg);
- // DispatchMessage(&msg);
- // }
- // return msg.wParam;
- //
- //}
- //
- //LRESULT CALLBACK WndProc(HWND hwnd, UINT message, WPARAM wParam, LPARAM lParam)
- //{
- // static int cxChar, cxCaps, cyChar;
- // TCHAR szBuffer[10];
- // HDC hdc;
- // int i;
- // PAINTSTRUCT ps;
- // TEXTMETRIC tm;
- //
- // switch (message)
- // {
- // case WM_CREATE:
- // hdc = GetDC(hwnd);
- // GetTextMetrics(hdc, &tm);
- // cxChar = tm.tmAveCharWidth;
- // cxCaps = (tm.tmPitchAndFamily & 1 ? 3 : 2) * cxChar / 2;
- // cyChar = tm.tmHeight + tm.tmExternalLeading;
- // ReleaseDC(hwnd, hdc);
- // return 0;
- //
- // case WM_PAINT:
- // hdc = BeginPaint(hwnd, &ps);
- // for (i = 0; i < NUMLINES; i++)
- // {
- // TextOut(hdc, 0, cyChar * i, devcaps[i].szLabel,lstrlen(devcaps[i].szLabel));
- // TextOut(hdc, 14 * cxCaps, cyChar * i, devcaps[i].szDesc, lstrlen(devcaps[i].szDesc));
- // SetTextAlign(hdc, TA_RIGHT | TA_TOP);
- // TextOut(hdc, 14 * cxCaps + 35 * cxChar, cyChar * i, szBuffer, wsprintf(szBuffer, TEXT("%5d"), GetDeviceCaps(hdc, devcaps[i].iIndex)));
- // SetTextAlign(hdc, TA_LEFT | TA_TOP);
- // }
- // EndPaint(hwnd, &ps);
- // return 0;
- //
- // case WM_DESTROY:
- // PostQuitMessage(0);
- // return 0;
- // }
- // return DefWindowProc(hwnd, message, wParam, lParam);
- //}
- //SYSMETS3
- //#include <windows.h>
- //#include "SYSMETS.h"
- //LRESULT CALLBACK WndProc(HWND, UINT, WPARAM, LPARAM);
- //int WINAPI WinMain(HINSTANCE hInstance, HINSTANCE hPrevInstance,
- // PSTR szCmdLine, int iCmdShow)
- //{
- // static TCHAR szAppName[] = TEXT("SysMets3");
- // HWND hwnd;
- // MSG msg;
- // WNDCLASS wndclass;
- // wndclass.style = CS_HREDRAW | CS_VREDRAW;
- // wndclass.lpfnWndProc = WndProc;
- // wndclass.cbClsExtra = 0;
- // wndclass.cbWndExtra = 0;
- // wndclass.hInstance = hInstance;
- // wndclass.hIcon = LoadIcon(NULL, IDI_APPLICATION);
- // wndclass.hCursor = LoadCursor(NULL, IDC_ARROW);
- // wndclass.hbrBackground = (HBRUSH)GetStockObject(WHITE_BRUSH);
- // wndclass.lpszMenuName = NULL;
- // wndclass.lpszClassName = szAppName;
- // if (!RegisterClass(&wndclass))
- // {
- // MessageBox(NULL, TEXT("Program requires Windows NT!"),
- // szAppName, MB_ICONERROR);
- // return 0;
- // }
- // hwnd = CreateWindow(szAppName, TEXT("Get System Metrics No. 3"),
- // WS_OVERLAPPEDWINDOW | WS_VSCROLL | WS_HSCROLL,
- // CW_USEDEFAULT, CW_USEDEFAULT,
- // CW_USEDEFAULT, CW_USEDEFAULT,
- // NULL, NULL, hInstance, NULL);
- // ShowWindow(hwnd, iCmdShow);
- // UpdateWindow(hwnd);
- // while (GetMessage(&msg, NULL, 0, 0))
- // {
- // TranslateMessage(&msg);
- // DispatchMessage(&msg);
- // }
- // return msg.wParam;
- //}
- //LRESULT CALLBACK WndProc(HWND hwnd, UINT message, WPARAM wParam, LPARAM lParam)
- //{
- // static int cxChar, cxCaps, cyChar, cxClient, cyClient, iMaxWidth;
- // HDC hdc;
- // int i, x, y, iVertPos, iHorzPos, iPaintBeg, iPaintEnd;
- // PAINTSTRUCT ps;
- // SCROLLINFO si;
- // TCHAR szBuffer[10];
- // TEXTMETRIC tm;
- // switch (message)
- // {
- // case WM_CREATE:
- // hdc = GetDC(hwnd);
- // GetTextMetrics(hdc, &tm);
- // cxChar = tm.tmAveCharWidth;
- // cxCaps = (tm.tmPitchAndFamily & 1 ? 3 : 2) * cxChar / 2;
- // cyChar = tm.tmHeight + tm.tmExternalLeading;
- // ReleaseDC(hwnd, hdc);
- // iMaxWidth = 40 * cxChar + 22 * cxCaps;
- // return 0;
- // case WM_SIZE:
- // cxClient = LOWORD(lParam);
- // cyClient = HIWORD(lParam);
- // si.cbSize = sizeof(si);
- // si.fMask = SIF_RANGE | SIF_PAGE;
- // si.nMin = 0;
- // si.nMax = NUMLINES - 1;
- // si.nPage = cyClient / cyChar;
- // SetScrollInfo(hwnd, SB_VERT, &si, TRUE);
- // si.cbSize = sizeof(si);
- // si.fMask = SIF_RANGE | SIF_PAGE;
- // si.nMin = 0;
- // si.nMax = 2 + iMaxWidth / cxChar;
- // si.nPage = cxClient / cxChar;
- // SetScrollInfo(hwnd, SB_HORZ, &si, TRUE);
- // return 0;
- // case WM_VSCROLL:
- // si.cbSize = sizeof(si);
- // si.fMask = SIF_ALL;
- // GetScrollInfo(hwnd, SB_VERT, &si);
- // iVertPos = si.nPos;
- // switch (LOWORD(wParam))
- // {
- // case SB_TOP:
- // si.nPos = si.nMin;
- // break;
- // case SB_BOTTOM:
- // si.nPos = si.nMax;
- // break;
- // case SB_LINEUP:
- // si.nPos -= 1;
- // break;
- // case SB_LINEDOWN:
- // si.nPos += 1;
- // break;
- // case SB_PAGEUP:
- // si.nPos -= si.nPage;
- // break;
- // case SB_PAGEDOWN:
- // si.nPos += si.nPage;
- // break;
- // case SB_THUMBTRACK:
- // si.nPos = si.nTrackPos;
- // break;
- // default:
- // break;
- // }
- // si.fMask = SIF_POS;
- // SetScrollInfo(hwnd, SB_VERT, &si, TRUE);
- // GetScrollInfo(hwnd, SB_VERT, &si);
- // if (si.nPos != iVertPos)
- // {
- // ScrollWindow(hwnd, 0, cyChar * (iVertPos - si.nPos),
- // NULL, NULL);
- // UpdateWindow(hwnd);
- // }
- // return 0;
- // case WM_HSCROLL:
- // si.cbSize = sizeof(si);
- // si.fMask = SIF_ALL;
- // GetScrollInfo(hwnd, SB_HORZ, &si);
- // iHorzPos = si.nPos;
- // switch (LOWORD(wParam))
- // {
- // case SB_LINELEFT:
- // si.nPos -= 1;
- // break;
- // case SB_LINERIGHT:
- // si.nPos += 1;
- // break;
- // case SB_PAGELEFT:
- // si.nPos -= si.nPage;
- // break;
- // case SB_PAGERIGHT:
- // si.nPos += si.nPage;
- // break;
- // case SB_THUMBPOSITION:
- // si.nPos = si.nTrackPos;
- // break;
- // default:
- // break;
- // }
- //
- // si.fMask = SIF_POS;
- // SetScrollInfo(hwnd, SB_HORZ, &si, TRUE);
- // GetScrollInfo(hwnd, SB_HORZ, &si);
- // if (si.nPos != iHorzPos)
- // {
- // ScrollWindow(hwnd, cxChar * (iHorzPos - si.nPos), 0,
- // NULL, NULL);
- // }
- // return 0;
- // case WM_PAINT:
- // hdc = BeginPaint(hwnd, &ps);
- // si.cbSize = sizeof(si);
- // si.fMask = SIF_POS;
- // GetScrollInfo(hwnd, SB_VERT, &si);
- // iVertPos = si.nPos;
- // GetScrollInfo(hwnd, SB_HORZ, &si);
- // iHorzPos = si.nPos;
- // iPaintBeg = max(0, iVertPos + ps.rcPaint.top / cyChar);
- // iPaintEnd = min(NUMLINES - 1,iVertPos + ps.rcPaint.bottom / cyChar);
- // for (i = iPaintBeg; i <= iPaintEnd; i++)
- // {
- // x = cxChar * (1 - iHorzPos);
- // y = cyChar * (i - iVertPos);
- // TextOut(hdc, x, y,
- // sysmetrics[i].szLabel,
- // lstrlen(sysmetrics[i].szLabel));
- // TextOut(hdc, x + 22 * cxCaps, y,
- // sysmetrics[i].szDesc,
- // lstrlen(sysmetrics[i].szDesc));
- // SetTextAlign(hdc, TA_RIGHT | TA_TOP);
- // TextOut(hdc, x + 22 * cxCaps + 40 * cxChar, y, szBuffer,
- // wsprintf(szBuffer, TEXT("%5d"),
- // GetSystemMetrics(sysmetrics[i].iIndex)));
- // SetTextAlign(hdc, TA_LEFT | TA_TOP);
- // }
- // EndPaint(hwnd, &ps);
- // return 0;
- // case WM_DESTROY:
- // PostQuitMessage(0);
- // return 0;
- // }
- // return DefWindowProc(hwnd, message, wParam, lParam);
- //}
- //SYSMETS2
- //#include<Windows.h>
- //#include "SYSMETS.h"
- //
- //LRESULT CALLBACK WndProc(HWND, UINT, WPARAM, LPARAM);
- //
- //int WINAPI WinMain(HINSTANCE hInstance, HINSTANCE hPrevInstance, PSTR szCmdLine, int iCmdShow)
- //{
- // static TCHAR szAppName[] = TEXT("SysMets2");
- // HWND hwnd;
- // MSG msg;
- // WNDCLASS wndclass;
- //
- // wndclass.style = CS_HREDRAW | CS_VREDRAW;
- // wndclass.lpfnWndProc = WndProc;
- // wndclass.cbClsExtra = 0;
- // wndclass.cbWndExtra = 0;
- // wndclass.hInstance = hInstance;
- // wndclass.hIcon = LoadIcon(NULL, IDI_APPLICATION);
- // wndclass.hCursor = LoadCursor(NULL, IDC_ARROW);
- // wndclass.hbrBackground = (HBRUSH)GetStockObject(WHITE_BRUSH);
- // wndclass.lpszMenuName = NULL;
- // wndclass.lpszClassName = szAppName;
- //
- // if (!RegisterClass(&wndclass))
- // {
- // MessageBox(NULL, TEXT("This program requires Windows NT!"), szAppName, MB_ICONERROR);
- // return 0;
- // }
- //
- // hwnd = CreateWindow(szAppName, TEXT("Get System Metrics No.2"), WS_OVERLAPPEDWINDOW | WS_VSCROLL, CW_USEDEFAULT, CW_USEDEFAULT, CW_USEDEFAULT, CW_USEDEFAULT, NULL, NULL, hInstance, NULL);
- // ShowWindow(hwnd, iCmdShow);
- // UpdateWindow(hwnd);
- //
- // while (GetMessage(&msg, NULL, 0, 0))
- // {
- // TranslateMessage(&msg);
- // DispatchMessage(&msg);
- // }
- // return msg.wParam;
- //}
- //
- //LRESULT CALLBACK WndProc(HWND hwnd, UINT message, WPARAM wParam, LPARAM lParam)
- //{
- // static int cxChar, cxCaps, cyChar, cyClient, iVscrollPos;
- // HDC hdc;
- // int i, y;
- // PAINTSTRUCT ps;
- // TCHAR szBuffer[10];
- // TEXTMETRIC tm;
- //
- // switch (message)
- // {
- // case WM_CREATE:
- // hdc = GetDC(hwnd);
- // GetTextMetrics(hdc, &tm);
- // cxChar = tm.tmAveCharWidth;
- // cxCaps = (tm.tmPitchAndFamily & 1 ? 3 : 2) * cxChar / 2;
- // cyChar = tm.tmHeight + tm.tmExternalLeading;
- // ReleaseDC(hwnd, hdc);
- // SetScrollRange(hwnd, SB_VERT, 0, NUMLINES - 1, FALSE);
- // SetScrollPos(hwnd, SB_VERT, iVscrollPos, TRUE);
- // return 0;
- //
- // case WM_SIZE:
- // cyClient = HIWORD(lParam);
- // return 0;
- //
- // case WM_VSCROLL:
- // switch (LOWORD(wParam))
- // {
- // case SB_LINEUP:
- // iVscrollPos -= 1;
- // break;
- // case SB_LINEDOWN:
- // iVscrollPos -= 1;
- // break;
- // case SB_PAGEUP:
- // iVscrollPos -= cyClient / cyChar;
- // break;
- // case SB_PAGEDOWN:
- // iVscrollPos = HIWORD(wParam);
- // break;
- // case SB_THUMBPOSITION:
- // iVscrollPos = HIWORD(wParam);
- // break;
- // default:
- // break;
- // }
- //
- // iVscrollPos = max(0, min(iVscrollPos, NUMLINES - 1));
- // if (iVscrollPos != GetScrollPos(hwnd, SB_VERT))
- // {
- // SetScrollPos(hwnd, SB_VERT, iVscrollPos, TRUE);
- // InvalidateRect(hwnd, NULL, TRUE);
- // }
- // return 0;
- //
- // case WM_PAINT:
- // hdc = BeginPaint(hwnd, &ps);
- // for (i = 0; i < NUMLINES; i++)
- // {
- // y = cyChar * (i - iVscrollPos);
- // TextOut(hdc, 0, y, sysmetrics[i].szLabel, lstrlen(sysmetrics[i].szLabel));
- // TextOut(hdc, 22 * cxCaps, y, sysmetrics[i].szDesc, lstrlen(sysmetrics[i].szDesc));
- // SetTextAlign(hdc, TA_RIGHT | TA_TOP);
- // TextOut(hdc, 22 * cxCaps + 40 * cxChar, y, szBuffer, wsprintf(szBuffer, TEXT("%d"), GetSystemMetrics(sysmetrics[i].iIndex)));
- // SetTextAlign(hdc, TA_LEFT | TA_TOP);
- // }
- // EndPaint(hwnd, &ps);
- // return 0;
- //
- // case WM_DESTROY:
- // PostQuitMessage(0);
- // return 0;
- // }
- // return DefWindowProc(hwnd, message, wParam, lParam);
- //
- //}
- //SYSMETS1
- //#include<windows.h>
- //#include "SYSMETS.h"
- //
- //LRESULT CALLBACK WndProc(HWND, UINT, WPARAM, LPARAM);
- //
- //int WINAPI WinMain(HINSTANCE hInstance, HINSTANCE hPrevInstance, PSTR szCmdLine, int iCmdShow)
- //{
- // static TCHAR szAppName[] = TEXT("SysMets1");
- // HWND hwnd;
- // MSG msg;
- // WNDCLASS wndclass;
- //
- // wndclass.style = CS_HREDRAW | CS_VREDRAW;
- // wndclass.lpfnWndProc = WndProc;
- // wndclass.cbClsExtra = 0;
- // wndclass.cbWndExtra = 0;
- // wndclass.hInstance = hInstance;
- // wndclass.hIcon = LoadIcon(NULL, IDI_APPLICATION);
- // wndclass.hCursor = LoadCursor(NULL, IDC_ARROW);
- // wndclass.hbrBackground = (HBRUSH)GetStockObject(WHITE_BRUSH);
- // wndclass.lpszMenuName = NULL;
- // wndclass.lpszClassName = szAppName;
- //
- // if (!RegisterClass(&wndclass))
- // {
- // MessageBox(NULL, TEXT("This program requires Windows NT!"), szAppName, MB_ICONERROR);
- // return 0;
- // }
- //
- // hwnd = CreateWindow(szAppName, TEXT("Get System Metrics No.1"), WS_OVERLAPPEDWINDOW, CW_USEDEFAULT, CW_USEDEFAULT, CW_USEDEFAULT, CW_USEDEFAULT, NULL, NULL, hInstance, NULL);
- // ShowWindow(hwnd, iCmdShow);
- // UpdateWindow(hwnd);
- // while (GetMessage(&msg, NULL, 0, 0))
- // {
- // TranslateMessage(&msg);
- // DispatchMessage(&msg);
- // }
- // return msg.wParam;
- //}
- //
- //LRESULT CALLBACK WndProc(HWND hwnd, UINT message, WPARAM wParam, LPARAM lParam)
- //{
- // static int cxChar, cxCaps, cyChar;
- // HDC hdc;
- // int i;
- // PAINTSTRUCT ps;
- // TCHAR szBuffer[10];
- // TEXTMETRIC tm;
- //
- // switch (message)
- // {
- // case WM_CREATE:
- // hdc = GetDC(hwnd);
- // GetTextMetrics(hdc, &tm);
- // cxChar = tm.tmAveCharWidth;
- // cxCaps = (tm.tmPitchAndFamily & 1 ? 3 : 2)* cxChar / 2;
- // cyChar = tm.tmHeight + tm.tmExternalLeading;
- // ReleaseDC(hwnd, hdc);
- // return 0;
- //
- // case WM_PAINT:
- // hdc = BeginPaint(hwnd, &ps);
- // for (i = 0; i < NUMLINES; i++)
- // {
- // TextOut(hdc, 0, cyChar * i, sysmetrics[i].szLabel, lstrlen(sysmetrics[i].szLabel));
- // TextOut(hdc, 22 * cxChar, cyChar * i, sysmetrics[i].szDesc, lstrlen(sysmetrics[i].szDesc));
- // SetTextAlign(hdc, TA_RIGHT | TA_TOP);
- // TextOut(hdc, 22 * cxCaps + 40 * cxChar, cyChar * i, szBuffer, wsprintf(szBuffer, TEXT("%5d"), GetSystemMetrics(sysmetrics[i].iIndex)));
- // SetTextAlign(hdc, TA_LEFT | TA_TOP);
- // }
- // EndPaint(hwnd, &ps);
- // return 0;
- //
- // case WM_DESTROY:
- // PostQuitMessage(0);
- // return 0;
- // }
- // return DefWindowProc(hwnd, message, wParam, lParam);
- //}
- // HELLOWIN
- //#include <windows.h>
- //
- //LRESULT CALLBACK WndProc(HWND, UINT, WPARAM, LPARAM);
- //
- //int WINAPI WinMain(HINSTANCE hInstance, HINSTANCE hPrevInstance,
- // PSTR szCmdLine, int iCmdShow)
- //{
- // static TCHAR szAppName[] = TEXT("HelloWin");
- // HWND hwnd;
- // MSG msg;
- // WNDCLASS wndclass;
- //
- // wndclass.style = CS_HREDRAW | CS_VREDRAW;
- // wndclass.lpfnWndProc = WndProc;
- // wndclass.cbClsExtra = 0;
- // wndclass.cbWndExtra = 0;
- // wndclass.hInstance = hInstance;
- // wndclass.hIcon = LoadIcon(NULL, IDI_APPLICATION);
- // wndclass.hCursor = LoadCursor(NULL, IDC_ARROW);
- // wndclass.hbrBackground = (HBRUSH)GetStockObject(WHITE_BRUSH);
- // wndclass.lpszMenuName = NULL;
- // wndclass.lpszClassName = szAppName;
- //
- // if (!RegisterClass(&wndclass))
- // {
- // MessageBox(NULL, TEXT("This program requires Windows NT!"),
- // szAppName, MB_ICONERROR);
- // return 0;
- // }
- //
- // hwnd = CreateWindow(szAppName, // window class name
- // TEXT("The Hello Program"), // window caption
- // WS_OVERLAPPEDWINDOW, // window style
- // CW_USEDEFAULT, // initial x position
- // CW_USEDEFAULT, // initial y position
- // CW_USEDEFAULT, // initial x size
- // CW_USEDEFAULT, // initial y size
- // NULL, // parent window handle
- // NULL, // window menu handle
- // hInstance, // program instance handle
- // NULL); // creation parameters
- //
- // ShowWindow(hwnd, iCmdShow);
- // UpdateWindow(hwnd);
- //
- // while (GetMessage(&msg, NULL, 0, 0))
- // {
- // TranslateMessage(&msg);
- // DispatchMessage(&msg);
- // }
- // return msg.wParam;
- //}
- //
- //LRESULT CALLBACK WndProc(HWND hwnd, UINT message, WPARAM wParam, LPARAM lParam)
- //{
- // HDC hdc;
- // PAINTSTRUCT ps;
- // RECT rect;
- //
- // switch (message)
- // {
- //
- // /* case WM_CREATE:
- // PlaySound(TEXT("hellowin.wav"), NULL, SND_FILENAME | SND_ASYNC);
- // return 0;*/
- //
- // case WM_PAINT:
- // hdc = BeginPaint(hwnd, &ps);
- //
- // GetClientRect(hwnd, &rect);
- //
- // DrawText(hdc, TEXT("Hello, Windows 98!"), -1, &rect,
- // DT_SINGLELINE | DT_CENTER | DT_VCENTER);
- //
- // EndPaint(hwnd, &ps);
- // return 0;
- //
- // case WM_DESTROY:
- // PostQuitMessage(0);
- // return 0;
- // }
- // return DefWindowProc(hwnd, message, wParam, lParam);
- //}
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement