| 网站首页 | 业界新闻 | 小组 | 威客 | 人才 | 下载频道 | 博客 | 代码贴 | 在线编程 | 编程论坛
欢迎加入我们,一同切磋技术
用户名:   
 
密 码:  
共有 511 人关注过本帖
标题:[求助]编译连接通过后为什么不能执行(再问一个)
取消只看楼主 加入收藏
lcz
Rank: 1
等 级:新手上路
帖 子:3
专家分:0
注 册:2006-1-10
收藏
 问题点数:0 回复次数:0 
[求助]编译连接通过后为什么不能执行(再问一个)

不好意思,这个也不能执行,差在哪?
#include <windows.h>
#include <stdlib.h>
#include <string.h>
long WINAPI WndProc(HWND,UINT,UINT,LONG);
BOOL InitWindowsClass(HINSTANCE);
BOOL InitWindows(HINSTANCE,int);
HWND hwndmain;
int WINAPI WinMain(HINSTANCE hInstance,HINSTANCE hPrevInstance,LPSTR lpCmdLine,int nCmdShow)
{
MSG message;
if(!InitWindowsClass(hInstance))
return FALSE;
if(!InitWindows(hInstance,nCmdShow))
return FALSE;
while(GetMessage(&message,0,0,0))
{
TranslateMessage(&message);
DispatchMessage(&message);
}
return message.wParam;
}

long WINAPI WndProc(HWND hwnd,UINT iMessage,UINT wParam,LONG lParam)
{
HDC hDC;
HBRUSH hBrush;
HPEN hPen;
PAINTSTRUCT PtStr;
POINT points[6]={{100,212},{70,222},{70,250},{130,250},{130,227},{100,212}};


switch(iMessage)
{
case WM_PAINT:
hDC=BeginPaint(hwnd,&PtStr);
hPen=(HPEN)GetStockObject(NULL_PEN);
SelectObject(hDC,hPen);
hBrush=(HBRUSH)GetStockObject(BLACK_BRUSH);
SelectObject(hDC,hBrush);
LineTo(hDC,50,50);
DeleteObject(hPen);
hPen=CreatePen(PS_SOLID,2,RGB(255,0,0));
SelectObject(hDC,hPen);
LineTo(hDC,150,50);
LineTo(hDC,100,137);
LineTo(hDC,50,50);

Polyline(hDC,points,6);
Arc(hDC,63,137,138,212,100,137,100,137);
Pie(hDC,213,137,288,212,240,137,260,137);
Rectangle(hDC,213,212,287,250);
RoundRect(hDC,213,100,287,137,20,20);
DeleteObject(hPen);
DeleteObject(hBrush);
EndPaint(hwnd,&PtStr);
return 0;


case WM_DESTROY:
PostQuitMessage(0);
return 0;
default:
return DefWindowProc(hwnd,iMessage,wParam,lParam);
}
}

BOOL InitWindows(HINSTANCE hInstance,int nCmdShow)
{
HWND hwnd;
hwnd=CreateWindow("WinFill","填充示例程序",WS_OVERLAPPEDWINDOW,CW_USEDEFAULT,0,CW_USEDEFAULT,0,NULL,NULL,hInstance,NULL);
if(!hwnd)
return FALSE;
hwndmain=hwnd;
ShowWindow(hwnd,nCmdShow);
UpdateWindow(hwnd);
return TRUE;
}

BOOL InitWindowsClass(HINSTANCE hInstance)
{
WNDCLASS wndclass;
wndclass.cbClsExtra=0;
wndclass.cbWndExtra=0;
wndclass.hbrBackground=(HBRUSH)(GetStockObject(WHITE_BRUSH));
wndclass.hCursor=LoadIcon(NULL,"END");
wndclass.hInstance=hInstance;
wndclass.lpfnWndProc=WndProc;
wndclass.lpszClassName="WinFill";
wndclass.lpszMenuName=NULL;
wndclass.style=CS_HREDRAW|CS_VREDRAW;
return RegisterClass(&wndclass);
}

搜索更多相关主题的帖子: 编译 
2006-01-10 20:22
快速回复:[求助]编译连接通过后为什么不能执行(再问一个)
数据加载中...
 
   



关于我们 | 广告合作 | 编程中国 | 清除Cookies | TOP | 手机版

编程中国 版权所有,并保留所有权利。
Powered by Discuz, Processed in 0.016118 second(s), 8 queries.
Copyright©2004-2024, BCCN.NET, All Rights Reserved