一个简单的windows程序?急急请教?

[复制链接]
查看11 | 回复1 | 2008-11-11 21:50:01 | 显示全部楼层 |阅读模式
#include
LRESULT CALLBACK WndProc(HWND hWnd,UINT message,WPARAM wParam,LPARAM lParam)
{
HDC hDC;
HBRUSH hBrush;
HPEN hPen;
PAINTSTRUCT PtStr;
switch(message)
{
case WM_PAINT:
hDC=BeginPaint(hWnd,&PtStr);
SetMapMode(hDC,MM_ANISOTROPIC);
hPen=(HPEN)GetStockObject(BLACK_PEN);
SelectObject(hDC,hPen);
hBrush=(HBRUSH)GetStockObject(DKGRAY_BRUSH);
SelectObject(hDC,hBrush);
RoundRect(hDC,50,50,100,100,15,15);
hBrush=(HBRUSH)GetStockObject(HOLLOW_BRUSH);
SelectObject(hDC,hBrush);
Pie(hDC,250,50,300,100,250,50,300,50);
EndPaint(hWnd,&PtStr);
//Pie(hDC,250,50,300,100,250,50,300,50);

return 0;
case WM_DESTROY:
PostQuitMessage(0);
return 0;
default:
return(DefWindowProc(hWnd,message,wParam,lParam));
}
}
BOOL InitWindows(HINSTANCE hInstance,int nCmdShow)
{
HWND hWnd;
hWnd=CreateWindow("WinFill",
"填丛图",
WS_OVERLAPPEDWINDOW,
CW_USEDEFAULT,
CW_USEDEFAULT,
CW_USEDEFAULT,
CW_USEDEFAULT,

NULL,
NULL,
hInstance,
NULL);
if(!hWnd)return FALSE;
ShowWindow(hWnd,SW_SHOWMINNOACTIVE);
UpdateWindow(hWnd);
return TRUE;
}
BOOL InitWindowsClass(HINSTANCE hInstance)
{
WNDCLASS wndclass;
wndclass.cbClsExtra=0;
wndclass.cbWndExtra=0;
wndclass.hbrBackground=(HBRUSH)GetStockObject(WHITE_BRUSH);
wndclass.hCursor=LoadCursor(NULL,IDC_ARROW);
wndclass.hIcon=LoadIcon(NULL,"END");
wndclass.hInstance=hInstance;
wndclass.lpfnWndProc=WndProc;
wndclass.lpszClassName="WinFill";
wndclass.lpszMenuName=NULL;
wndclass.style=CS_HREDRAW|CS_VREDRAW;
return RegisterClass(&wndclass);
}
int WINAPI WinMain(HINSTANCE hInstance,HINSTANCE hPrevInstance,LPSTR lpCmdLine,int nShowCmd)
{
MSG Message;
if(!InitWindowsClass(hInstance))
return FALSE;
if(!InitWindows(hInstance,1))
return FALSE;
while(GetMessage(&Message,0,0,0))
{
TranslateMessage(&Message);
DispatchMessage(&Message);
}
return Message.wParam;
}
不胜感激。

回复

使用道具 举报

千问 | 2008-11-11 21:50:01 | 显示全部楼层
描述清楚你的问题OK?你这是算灌水吗?是的话鄙视...
回复

使用道具 举报

您需要登录后才可以回帖 登录 | 立即注册

本版积分规则

主题

0

回帖

4882万

积分

论坛元老

Rank: 8Rank: 8

积分
48824836
热门排行