Chinaunix首页 | 论坛 | 博客
  • 博客访问: 735252
  • 博文数量: 769
  • 博客积分: 6000
  • 博客等级: 准将
  • 技术积分: 4985
  • 用 户 组: 普通用户
  • 注册时间: 2008-10-15 16:37
文章分类

全部博文(769)

文章存档

2011年(1)

2008年(768)

我的朋友

分类:

2008-10-15 16:40:06

 //源程序如下
#include
#include
#include
#include
#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);


--------------------next---------------------

阅读(353) | 评论(0) | 转发(0) |
给主人留下些什么吧!~~