求助:我下面这段小程序编译时出现如下一些错误,请各位大哥帮我看看,谢谢!
#include "windows.h "
#include "hge.h " //HGE
#include "hgesprite.h " //精灵
#include "hgefont.h " //字体
#include "hgeparticle.h " //粒子
#pragma comment(lib, "lib\\vc\\hge.lib "); //库
#pragma comment(lib, "lib\\vc\\hgehelp.lib "); //库
// Pointer to the HGE interface.
// Helper classes require this to work.
HGE *hge=0; //初始化
// Pointers to the HGE objects we will use
//HGE 对象定义 精灵 (就是圆圈)
hgeSprite*spr; //把图片贴到屏幕上的一个工具
hgeSprite*spt; //精灵
hgeFont*fnt; //字体
//粒子系统
hgeParticleSystem*par; //就是碰撞时产生的 星星
// Handles for HGE resourcces
HTEXTUREtex; //理纹 得到一幅大图片
HEFFECTsnd;
bool FrameFunc()
{
return false;
}
bool RenderFunc() //渲染
{
return false; //继续循环
}
int WINAPI WinMain(HINSTANCE, HINSTANCE, LPSTR, int)
{
MSG msg;
hge = hgeCreate(HGE_VERSION);
hge-> System_SetState((hgeIntState)14,(int)0xFACE0FF);
hge-> System_SetState(HGE_LOGFILE, "hge_tut03.log ");
hge-> System_SetState(HGE_FRAMEFUNC, FrameFunc);
hge-> System_SetState(HGE_RENDERFUNC, RenderFunc);
hge-> System_SetState(HGE_TITLE, "HGE Tutorial 03 - Using helper classes ");
hge-> System_SetState(HGE_FPS, 100);
hge-> System_SetState(HGE_WINDOWED, true);
hge-> System_SetState(HGE_SCREENWIDTH, 800);
hge-> System_SetState(HGE_SCREENHEIGHT, 600);
hge-> System_SetState(HGE_SCREENBPP, 32);
hge-> System_SetState(HGE_USESOUND, true);
if(hge-> System_Initiate())
{
//hge-> System_Start();
HWND hWnd = hge-> System_GetState(HGE_HWND);
this-> m_101dWndProc = SetWindowLong(hWnd,GWL_WNDPROC,(LONG)YourWndProc);
}
else
return false;
return 0;
}
LONG 101dProc = GetWindowLong(GWL_PROC);
SetWindowLong(GML_PROC,YourWndProc);
//CallWindowProc( lOldProc, ...... );
HRESULT YourWndProc(HWND hWnd, UINT nMsg, WPARAM wParam, LPARAM lParam)
{
MsgProc(nMsg, wParam, lParam);
return Call WindowProc((WNDPROC)m_101dWndProc, hWnd, nMsg, wParam, lParam);
}
编译时出现如下提示:
--------------------Configuration: hge_tut03 - Win32 Debug--------------------
Compiling...
hge_tut03.cpp
E:\串口游戏\tutorial03\hge_tut03.cpp(83) : error C2673: 'WinMain ' : global functions do not have 'this ' pointers
E:\串口游戏\tutorial03\hge_tut03.cpp(83) : error C2227: left of '-> m_101dWndProc ' must point to class/struct/union
E:\串口游戏\tutorial03\hge_tut03.cpp(83) : error C2065: 'YourWndProc ' : undeclared identifier
E:\串口游戏\tutorial03\hge_tut03.cpp(93) : error C2059: syntax error : 'bad suffix on number '
E:\串口游戏\tutorial03\hge_tut03.cpp(93) : warning C4091: ' ' : ignored on left of 'long ' when no variable is declared
E:\串口游戏\tutorial03\hge_tut03.cpp(93) : error C2143: syntax error : missing '; ' before 'constant '
E:\串口游戏\tutorial03\hge_tut03.cpp(93) : fatal error C1004: unexpected end of file found
Error executing cl.exe.
hge_tut03.exe - 6 error(s), 1 warning(s)
请教:
我是哪些地方错了啊?
谢谢!
[解决办法]
this-> m_101dWndProc = SetWindowLong(hWnd,GWL_WNDPROC,(LONG)YourWndProc);
---
m_101dWndProc = SetWindowLong(hWnd,GWL_WNDPROC,(LONG)YourWndProc);
HRESULT YourWndProc(HWND hWnd, UINT nMsg, WPARAM wParam, LPARAM lParam)
main函数前声明