VC中画直线的问题

来源:百度知道 编辑:UC知道 时间:2024/06/03 15:56:36
错误提示如下:
--------------------Configuration: 画图 - Win32 Debug--------------------
Compiling...
1.cpp
C:\Documents and Settings\All Users\桌面\画图\1.cpp(15) : error C2065: 'WM_DESTORY' : undeclared identifier
C:\Documents and Settings\All Users\桌面\画图\1.cpp(15) : error C2051: case expression not constant
C:\Documents and Settings\All Users\桌面\画图\1.cpp(30) : error C2065: 'Line' : undeclared identifier
执行 cl.exe 时出错.

1.obj - 1 error(s), 0 warning(s)

代码如下:
#include<windows.h>
#define Line(hdc,x0,y0,x1,y1) MoveToEx(hdc,x0,y0,NULL),Line(hdc,x1,y1)
LRESULT CALLBACK WndProc(HWND hwnd,UINT message,WPARAM wparam,LPARAM lparam)
{static int cxclient,cyclient;
static int x0,y0,x1,y1;
static HPEN hpen0,hpen1;
HDC hdc;
int i;
PAINTSTRUCT PS;
switch(message)
{case WM_SIZE:
cxclient=LOWORD(lparam);<

'WM_DESTORY'应改为WM_DESTROY

#define Line(hdc,x0,y0,x1,y1) MoveToEx(hdc,x0,y0,NULL),Line(hdc,x1,y1)

改成

#define Line(hdc,x0,y0,x1,y1) MoveToEx(hdc,x0,y0,NULL),LineTo(hdc,x1,y1)
--------------------------------------------
你的程序不完整,在哪拷贝的,把漏掉的复制进来

配置错误。
点工程右键-》属性-》连接器-》system->子系统:修改为:Windows (/SUBSYSTEM:WINDOWS)

windows程序设计中WinMain相当于c中的main,程序固定从那里开始执行,你的程序中大概没有那个函数吧。建议安装Vissual Assist之类的智能提示软件,如此用C++6.0会非常爽的。