xml地图|网站地图|网站标签 [设为首页] [加入收藏]
绘图基础
分类:操作系统

图片 1图片 2

图片 3图片 4

Turn: 

 

  1 /*---------------------------------------------
  2 CHECKER3.C -- Mouse Hit-Test Demo Program No.3
  3               (c) Charles Petzold, 1998
  4 ---------------------------------------------*/
  5 
  6 #include <Windows.h>
  7 
  8 #define DIVISIONS 5
  9 
 10 LRESULT CALLBACK WndProc(HWND, UINT, WPARAM, LPARAM);
 11 LRESULT CALLBACK ChildWndProc(HWND, UINT, WPARAM, LPARAM);
 12 
 13 TCHAR szChildClass[] = TEXT("Checker3_Child");
 14 
 15 int WINAPI WinMain( __in HINSTANCE hInstance
 16                     , __in_opt HINSTANCE hPrevInstance
 17                     , __in LPSTR lpCmdLine
 18                     , __in int nShowCmd )
 19 {
 20     static TCHAR szAppName[] = TEXT("Checker3");
 21     HWND hwnd;
 22     MSG msg;
 23     WNDCLASS wndclass;
 24 
 25     wndclass.style = CS_HREDRAW | CS_VREDRAW;
 26     wndclass.lpfnWndProc = WndProc;
 27     wndclass.cbClsExtra = 0;
 28     wndclass.cbWndExtra = 0;
 29     wndclass.hInstance = hInstance;
 30     wndclass.hIcon = LoadIcon(NULL, IDI_APPLICATION);
 31     wndclass.hCursor = LoadCursor(NULL, IDC_ARROW);
 32     wndclass.hbrBackground = (HBRUSH)GetStockObject(WHITE_BRUSH);
 33     wndclass.lpszMenuName = NULL;
 34     wndclass.lpszClassName = szAppName;
 35 
 36     if (!RegisterClass(&wndclass))
 37     {
 38         MessageBox(NULL, TEXT("Program requires Windows NT!")
 39             , szAppName, MB_ICONERROR);
 40         return 0;
 41     }
 42 
 43     wndclass.lpfnWndProc = ChildWndProc;
 44     wndclass.cbWndExtra = sizeof(long);
 45     wndclass.hIcon = NULL;
 46     wndclass.lpszClassName = szChildClass;
 47 
 48     RegisterClass(&wndclass);
 49 
 50     hwnd = CreateWindow(szAppName, TEXT("Checker3 Mouse Hit-Test Demo")
 51         , WS_OVERLAPPEDWINDOW
 52         , CW_USEDEFAULT, CW_USEDEFAULT
 53         , CW_USEDEFAULT, CW_USEDEFAULT
 54         , NULL, NULL, hInstance, NULL);
 55 
 56     ShowWindow(hwnd, nShowCmd);
 57     UpdateWindow(hwnd);
 58 
 59     while (GetMessage(&msg, NULL, 0, 0))
 60     {
 61         TranslateMessage(&msg);
 62         DispatchMessage(&msg);
 63     }
 64 
 65     return msg.wParam;
 66 }
 67 
 68 LRESULT CALLBACK WndProc(HWND hwnd, UINT message, WPARAM wParam, LPARAM lParam)
 69 {
 70     static HWND hwndChild[DIVISIONS][DIVISIONS];
 71     int cxBlock, cyBlock, x, y;
 72 
 73     switch (message)
 74     {
 75     case WM_CREATE:
 76         for (x = 0; x != DIVISIONS; ++x)
 77             for (y = 0; y != DIVISIONS; ++y)
 78             {
 79                 hwndChild[x][y] = CreateWindow(szChildClass, NULL
 80                     , WS_CHILDWINDOW | WS_VISIBLE
 81                     , 0, 0, 0, 0
 82                     , hwnd, (HMENU)(y << 8 | x)
 83                     , (HINSTANCE)GetWindowLong(hwnd, GWL_HINSTANCE)
 84                     , NULL);
 85             }
 86         return 0;
 87 
 88     case WM_SIZE:
 89         cxBlock = LOWORD(lParam) / DIVISIONS;
 90         cyBlock = HIWORD(lParam) / DIVISIONS;
 91 
 92         for (x = 0; x != DIVISIONS; ++x)
 93             for(y = 0; y != DIVISIONS; ++y)
 94             {
 95                 MoveWindow(hwndChild[x][y]
 96                     , x * cxBlock, y * cyBlock
 97                     , cxBlock, cyBlock, TRUE);
 98             }
 99         return 0;
100 
101     case WM_LBUTTONDOWN:
102         MessageBeep(0);
103         return 0;
104 
105     case WM_DESTROY:
106         PostQuitMessage(0);
107         return 0;
108     }
109 
110     return DefWindowProc(hwnd, message, wParam, lParam);
111 }
112 
113 LRESULT CALLBACK ChildWndProc(HWND hwnd, UINT message, WPARAM wParam, LPARAM lParam)
114 {
115     HDC hdc;
116     PAINTSTRUCT ps;
117     RECT rect;
118 
119     switch (message)
120     {
121     case WM_CREATE:
122         SetWindowLong(hwnd, 0, 0);    // on/off flag
123         return 0;
124 
125     case WM_LBUTTONDOWN:
126         SetWindowLong(hwnd, 0, 1 ^ GetWindowLong(hwnd, 0));
127         InvalidateRect(hwnd, NULL, FALSE);
128         return 0;
129 
130     case WM_PAINT:
131         hdc = BeginPaint(hwnd, &ps);
132 
133         GetClientRect(hwnd, &rect);
134         Rectangle(hdc, 0, 0, rect.right, rect.bottom);
135 
136         if (GetWindowLong(hwnd, 0))
137         {
138             MoveToEx(hdc, 0, 0, NULL);
139             LineTo(hdc, rect.right, rect.bottom);
140             MoveToEx(hdc, 0, rect.bottom, NULL);
141             LineTo(hdc, rect.right, 0);
142         }
143 
144         EndPaint(hwnd, &ps);
145         return 0;
146     }
147 
148     return DefWindowProc(hwnd, message, wParam, lParam);
149 }
 1 //SINEWAVE.C -- Sine Wave Using Polyline (c) Charles Petzold, 1998
 2 #include <Windows.h>
 3 #include <math.h>
 4 
 5 #define NUM        1000
 6 #define TWOPI    (2 * 3.14159)
 7 
 8 LRESULT CALLBACK WndPorc(HWND, UINT, WPARAM, LPARAM);
 9 
10 int WINAPI WinMain( __in HINSTANCE hInstance
11                     , __in_opt HINSTANCE hPrevInstance
12                     , __in LPSTR lpCmdLine
13                     , __in int nShowCmd )
14 {
15     static TCHAR szAppName[] = TEXT("SineWave");
16     HWND hwnd;
17     MSG msg;
18     WNDCLASS wndclass;
19 
20     wndclass.style = CS_HREDRAW | CS_VREDRAW;
21     wndclass.lpfnWndProc = WndPorc;
22     wndclass.cbClsExtra = 0;
23     wndclass.cbWndExtra = 0;
24     wndclass.hInstance = hInstance;
25     wndclass.hIcon = LoadIcon(NULL, IDI_APPLICATION);
26     wndclass.hCursor = LoadCursor(NULL, IDC_ARROW);
27     wndclass.hbrBackground = (HBRUSH)GetStockObject(WHITE_BRUSH);
28     wndclass.lpszMenuName = NULL;
29     wndclass.lpszClassName = szAppName;
30 
31     if (!RegisterClass(&wndclass))
32     {
33         MessageBox(NULL, TEXT("Program requires Windows NT!")
34             , szAppName, MB_ICONERROR);
35         return 0;
36     }
37 
38     hwnd = CreateWindow(szAppName, TEXT("Sine Wave Using Polyline")
39         , WS_OVERLAPPEDWINDOW
40         , CW_USEDEFAULT, CW_USEDEFAULT
41         , CW_USEDEFAULT, CW_USEDEFAULT
42         , NULL, NULL, hInstance, NULL);
43 
44     ShowWindow(hwnd, nShowCmd);
45     UpdateWindow(hwnd);
46 
47     while (GetMessage(&msg, NULL, 0, 0))
48     {
49         TranslateMessage(&msg);
50         DispatchMessage(&msg);
51     }
52 
53     return msg.wParam;
54 }
55 
56 LRESULT CALLBACK WndPorc(HWND hwnd, UINT message, WPARAM wParam, LPARAM lParam)
57 {
58     static int cxClient, cyClient;
59     HDC hdc;
60     int i;
61     PAINTSTRUCT ps;
62     POINT apt[NUM];
63 
64     switch (message)
65     {
66     case WM_SIZE:
67         cxClient = LOWORD(lParam);
68         cyClient = HIWORD(lParam);
69         return 0;
70 
71     case WM_PAINT:
72         hdc = BeginPaint(hwnd, &ps);
73         
74         MoveToEx(hdc, 0, cyClient / 2, NULL);
75         LineTo(hdc, cxClient, cyClient / 2);
76         
77         for (i = 0; i != NUM; ++i)
78         {
79             apt[i].x = i * cxClient / NUM;
80             apt[i].y = (int)(cyClient / 2 * (1 - sin(TWOPI * i / NUM)));
81         }
82 
83         Polyline(hdc, apt, NUM);
84         EndPaint(hwnd, &ps);
85         return 0;
86 
87     case WM_DESTROY:
88         PostQuitMessage(0);
89         return 0;
90     }
91 
92     return DefWindowProc(hwnd, message, wParam, lParam);
93 }

Win10更新不能? 要这么修复才OK

图片 5

首先在开始菜单输入gpedit.msc,进入组策略管理器。

 

图片 6

在组策略的左侧依次单击打开“计算机配置—管理模板—Windows组件”,并在右侧下拉滚动条找到“Windows更新”项单击点选。

 

图片 7

 

双击打开,找到“配置自动更新”项,然后选择禁用,并点击应用生效,注意这个时候不要关闭窗口,一会儿我们要再次打开。

 

图片 8

 

图片 9

接下来,继续单击开始菜单(或按下Win键),输入“%SystemRoot%SoftwareDistribution”回车,打开文件夹。

 

图片 10

双击打开目录中的datastore文件夹,将里面所有文件删除,注意,是删除datastore文件夹内的文件,而不是删除整个文件夹。

 

图片 11

最后切换回“配置自动更新”页面,双击打开,再次将其调整为“未配置”点击应用生效就可以了。

 

图片 12

如此一来,Win10的更新失败问题就能迎刃而解了。另外,这个方法是根据专业版来操作的,使用家庭版的小伙伴如果也有这个需求,可以先浏览《家庭版用不了高级技巧?小编帮你找回组策略》,再跟着小编一起操作即可。

本文由澳门新葡亰手机版发布于操作系统,转载请注明出处:绘图基础

上一篇:右键菜单怎样添加,jQuery搜索框自动补全功能插 下一篇:逆向集录_00_不同程序OEP特征总结,win10锁屏或睡
猜你喜欢
热门排行
精彩图文