VC6.0中如何写入API

来源:百度知道 编辑:UC知道 时间:2024/05/12 05:31:03
我是新手不知道如何在VC6.0如何写入API函数?我想运行下API的例子,可不知道怎样做,我是这样做的:
1."文件"->"新建"->"工程"菜单->win32 Application
2.起一个工程名如:api
3.在弹出的菜单中选择"An empty project",点击"完成",再点"确定"
4.在工作区右下点"FileView"视图,然后"Source Files"右击->"Add Files to folder",建立一个api.cpp文件
5.双击"api.cpp"写入代码
6.出现24个错误如下:
--------------------Configuration: api - Win32 Debug--------------------
Compiling...
api.cpp
h:\c++\api\api.cpp(2) : error C2061: syntax error : identifier 'UNIT'
h:\c++\api\api.cpp(3) : error C2061: syntax error : identifier 'hPrevInst'
h:\c++\api\api.cpp(4) : error C2731: 'WinMain' : function cannot be overloaded
h:\c++\api\api.cpp(3) : see declaration of 'WinMain'
h:\c++\api\api.cpp(7) : error C2065: 'WNDCALSS' : undeclared identifier

你在第三步时不要用"An empty project",
用A Sample Win32 App,点击"完成",再点"确定"
再在FileView双击SourceFile,打开工程名.cpp删掉除了#include "stdafx.h"
以外的其它内容。把你的代码粘上去,这就可以跑了。

把源代码粘上来,好似少#include了头文件

你又没有描述你的api.cpp是怎样的.所以不知道哪里有错误。

好像不是An empty project吧,我去年学的时候冒似不是这样,具体是怎么样,忘了,嘿嘿