//源程序如下 #include <windows.h> #include <stdlib.h> #include <string.h> #include <math.h> #define PI 3.1415926
int nNum=0,nMaxNum=20; LRESULT CALLBACK WindowProc( HWND hwnd, // handle to window UINT uMsg, // message identifier WPARAM wParam, // first message parameter LPARAM lParam // second message parameter ); int WINAPI WinMain( HINSTANCE hInstance, // handle to current instance HINSTANCE hPrevInstance, // handle to previous instance LPSTR lpCmdLine, // command line int nCmdShow // show state ) { HWND hwnd; MSG Msg; WNDCLASS wndclass; wndclass.cbClsExtra=0; wndclass.cbWndExtra=0; wndclass.hbrBackground=(HBRUSH)GetStockObject(WHITE_BRUSH); wndclass.hCursor=LoadCursor(NULL,IDC_ARROW); wndclass.hIcon=LoadIcon(NULL,IDI_APPLICATION); wndclass.hInstance=hInstance; wndclass.lpfnWndProc=WindowProc; wndclass.lpszClassName="abc"; wndclass.lpszMenuName=NULL; wndclass.style=0; RegisterClass(&wndclass); hwnd=CreateWindow("abc","旋转的风车",WS_OVERLAPPEDWINDOW,CW_USEDEFAULT,0,600,450,NULL,NULL,hInstance,NULL); ShowWindow(hwnd,SW_SHOWNORMAL); UpdateWindow(hwnd); while(GetMessage(&Msg,hwnd,NULL,0)) { TranslateMessage(&Msg); DispatchMessage(&Msg); } return 0; } LRESULT CALLBACK WindowProc( HWND hwnd, // handle to window UINT uMsg, // message identifier WPARAM wParam, // first message parameter LPARAM lParam // second message parameter ) { HDC hdc; HBRUSH hBrush; HPEN hp; PAINTSTRUCT ps; int nCenterX,nCenterY; double fAngle; switch(uMsg) { case WM_PAINT: hdc=BeginPaint(hwnd,&ps); SetMapMode(hdc,MM_ANISOTROPIC); SetWindowExtEx(hdc,400,300,NULL); |