user-0 提问: 求大神给注释，谢了

回复:
user: user-1

user: user-2
content: #define _CRT_SECURE_NO_WARNINGS   #include <windows.h>   #include <math.h>   #include <time.h>   #pragma comment(lib, "user32.lib")   #pragma comment(lib, "gdi32.lib")   #pragma comment(linker, "/SUBSYSTEM:Windows")       void GetPos(double degree, int len, int* x, int* y)   {       *x = len * sin(degree);       *y = len * cos(degree);   }       void DrawClock(HWND hw, HDC h, int hour, int minute, int second)   {       HDC bufdc = CreateCompatibleDC(h);       HBITMAP buf = CreateCompatibleBitmap(bufdc, 200, 200);       RECT cr;       	/* 创建一个白色的画刷 */     HBRUSH bBg = CreateSolidBrush(RGB(255, 255, 255));       GetClientRect(hw, &cr);       SelectObject(bufdc, bBg);       SelectObject(bufdc, buf);           FillRect(bufdc, &cr, bBg);           {           int sx, sy, ex, ey;           int i;          /* 这里应该是标记出表上的12个时间点 每个标记是一个小短线*/         for(i = 0; i < 12; ++i) {               GetPos(2*3.14159/12*i, 85, &sx, &sy);               GetPos(2*3.14159/12*i, 95, &ex, &ey);               MoveToEx(bufdc, 100+sx, 100-sy, 0);               LineTo(bufdc, 100+ex, 100-ey);           }       }          /* 画出时针 分针 秒针 */     {           int hx, hy, mx, my, sx, sy;           GetPos(2*3.14159 / 12 * (hour + (double)minute / 60 + (double)second / 3600), 50, &hx, &hy);           GetPos(2*3.14159 / 60 * (minute + (double)second / 60), 65, &mx, &my);           GetPos(2*3.14159 / 60 * second, 80, &sx, &sy);           MoveToEx(bufdc, 100, 100, NULL);           LineTo(bufdc, 100+hx, 100-hy);           MoveToEx(bufdc, 100, 100, NULL);           LineTo(bufdc, 100+mx, 100-my);           MoveToEx(bufdc, 100, 100, NULL);           LineTo(bufdc, 100+sx, 100-sy);       }               BitBlt(h, 0, 0, 200, 200, bufdc, 0, 0, SRCCOPY);       	/* 释放分配的资源 */     DeleteDC(bufdc);       DeleteObject(bBg);       DeleteObject(buf);   }       LRESULT CALLBACK WndProc(HWND h, UINT m, WPARAM w, LPARAM l)   {       switch(m) {           case WM_CREATE:               SetTimer(h, 1, 1000, 0);   /* 设置时间间隔 每一秒作为一个时间间隔 */              return 0;           case WM_ERASEBKGND:               return 1;           case WM_TIMER:               InvalidateRect(h, 0, FALSE);               return 0;           case WM_PAINT: {               PAINTSTRUCT ps;               HDC dc = BeginPaint(h, &ps);               {                   time_t t;                   struct tm* pst;                   time(&t);                   pst = localtime(&t);                  /* 调用上面定义的函数 描绘出当前时钟 */                 DrawClock(h, dc, pst->tm_hour, pst->tm_min, pst->tm_sec);               }               EndPaint(h, &ps);               return 0;           }           case WM_DESTROY:               KillTimer(h, 1);    /* 杀死定时器 */              PostQuitMessage(0);               return 0;           default:               return DefWindowProc(h, m, w, l);       }   }       int APIENTRY WinMain(HINSTANCE hInst, HINSTANCE hPrev, LPSTR szCmd, INT nShow)   {       WNDCLASS wc;       ZeroMemory(&wc, sizeof(wc));       wc.style = CS_HREDRAW | CS_VREDRAW;       wc.lpfnWndProc = WndProc;       wc.hInstance = hInst;       wc.hbrBackground = (HBRUSH) COLOR_WINDOW;       wc.lpszClassName = TEXT("MYCLOCK");               if (RegisterClass(&wc) != 0) {           MSG m;           		/* 创建窗口 */         HWND hw = CreateWindow(TEXT("MYCLOCK"), TEXT("Clock"), WS_OVERLAPPEDWINDOW,               CW_USEDEFAULT, CW_USEDEFAULT, CW_USEDEFAULT, CW_USEDEFAULT, NULL, NULL, hInst, 0);                       if (hw != NULL) {               RECT r;               GetWindowRect(hw, &r);               r.right = r.left + 200;               r.bottom = r.top + 200;               AdjustWindowRect(&r, WS_OVERLAPPEDWINDOW, FALSE);               MoveWindow(hw, r.left, r.top, r.right - r.left, r.bottom - r.top, FALSE);               ShowWindow(hw, SW_SHOWNORMAL);    /* 将窗口显示出来 */              UpdateWindow(hw);                           while( GetMessage(&m, 0, 0, 0) > 0) {                   TranslateMessage(&m);                   DispatchMessage(&m);               }               return 0;           }           return 1;       } else           return 1; } 不要做伸手党 你自己找本书看看 这就是一个Win32 应用程序 我也很久不做Win32应用程序了 你可以找一下张孝祥的一本关于windows应用程序开发的书  或者是看一下孙鑫的那本VC++深入详解