4 LRESULT WINAPI MainWndProc(HWND, UINT, WPARAM, LPARAM);
7 WinMain(HINSTANCE hInstance,
8 HINSTANCE hPrevInstance,
16 wc.lpszClassName = "ClipClass";
17 wc.lpfnWndProc = MainWndProc;
18 wc.style = CS_VREDRAW | CS_HREDRAW;
19 wc.hInstance = hInstance;
20 wc.hIcon = LoadIcon(NULL, IDI_APPLICATION);
21 wc.hCursor = LoadCursor(NULL, IDC_ARROW);
22 wc.hbrBackground = (HBRUSH)GetStockObject(GRAY_BRUSH);
23 wc.lpszMenuName = NULL;
26 if (RegisterClass(&wc) == 0)
28 fprintf(stderr, "RegisterClass failed (last error 0x%X)\n",
33 hWnd = CreateWindow("ClipClass",
35 WS_OVERLAPPEDWINDOW|WS_HSCROLL|WS_VSCROLL,
46 fprintf(stderr, "CreateWindow failed (last error 0x%X)\n",
51 ShowWindow(hWnd, nCmdShow);
53 while(GetMessage(&msg, NULL, 0, 0))
55 TranslateMessage(&msg);
56 DispatchMessage(&msg);
77 { 50, 100, 125, 100 },
78 { 160, 100, 190, 100 },
79 { 300, 100, 225, 100 },
80 { 50, 125, 300, 125 },
81 { 50, 149, 125, 149 },
82 { 160, 149, 190, 149 },
83 { 300, 149, 225, 149 },
84 { 50, 150, 125, 150 },
85 { 160, 150, 190, 150 },
86 { 300, 150, 225, 150 },
87 { 160, 249, 190, 249 },
88 { 160, 250, 190, 250 },
89 { 149, 50, 149, 125 },
90 { 149, 160, 149, 190 },
91 { 149, 300, 149, 225 },
92 { 150, 50, 150, 125 },
93 { 150, 160, 150, 190 },
94 { 150, 300, 150, 225 },
95 { 199, 50, 199, 125 },
96 { 199, 160, 199, 190 },
97 { 199, 300, 199, 225 },
98 { 200, 50, 200, 125 },
99 { 200, 160, 200, 190 },
100 { 200, 300, 200, 225 },
101 { 175, 50, 175, 300 },
102 { 50, 55, 300, 290 },
103 { 300, 295, 50, 60 },
104 { 50, 290, 300, 55 },
105 { 300, 60, 50, 295 },
106 { 55, 50, 290, 300 },
107 { 295, 300, 60, 50 },
108 { 55, 300, 290, 50 },
113 for (i = 0; i < sizeof(points) / sizeof(points[0]); i++)
115 MoveToEx(hDC, points[i].fromx, points[i].fromy, NULL);
116 LineTo(hDC, points[i].tox, points[i].toy);
120 LRESULT CALLBACK MainWndProc(HWND hWnd, UINT msg, WPARAM wParam, LPARAM lParam)
125 HRGN ClipRgn, ExcludeRgn;
126 char spr[100], sir[100];
132 GetClientRect(hWnd, &clr);
133 ClipRgn = CreateRectRgnIndirect(&clr);
134 hDC = BeginPaint(hWnd, &ps);
139 FillRect(hDC, &Rect, CreateSolidBrush(RGB(0xFF, 0x00, 0x00)));
140 ExcludeRgn = CreateRectRgnIndirect(&Rect);
141 CombineRgn(ClipRgn, ClipRgn, ExcludeRgn, RGN_DIFF);
142 DeleteObject(ExcludeRgn);
147 FillRect(hDC, &Rect, CreateSolidBrush(RGB(0xFF, 0x00, 0x00)));
148 SelectObject(hDC, CreatePen(PS_SOLID, 0, RGB(0xFF, 0xFF, 0x00)));
150 SelectObject(hDC, CreatePen(PS_SOLID, 0, RGB(0x00, 0x00, 0xFF)));
151 ExcludeRgn = CreateRectRgnIndirect(&Rect);
152 CombineRgn(ClipRgn, ClipRgn, ExcludeRgn, RGN_DIFF);
153 DeleteObject(ExcludeRgn);
154 SelectClipRgn(hDC, ClipRgn);
164 return DefWindowProc(hWnd, msg, wParam, lParam);