仙境传说手机游戏:VC程序求助!!!!高手帮忙呀

来源:百度文库 编辑:高校问答 时间:2024/05/02 19:09:40
编译通过了,但是链接提示错误:
--------------------Configuration: por006 - Win32 Debug--------------------
Linking...
1.obj : error LNK2001: unresolved external symbol "int __cdecl InitWindow(struct HINSTANCE__ *,int)" (?InitWindow@@YAHPAUHINSTANCE__@@H@Z)
Debug/por006.exe : fatal error LNK1120: 1 unresolved externals
Error executing link.exe.

por006.exe - 2 error(s), 0 warning(s)

程序如下:
#include<windows.h>
BOOL InitWindow(HINSTANCE hInstance,int CmdShow);
LRESULT CALLBACK WinProc(HWND hWnd,UINT message,WPARAM wParam,LPARAM IParam);
HWND hwnd;
int PASCAL WinMain(HINSTANCE hInstance,HINSTANCE hPrevInstance,LPSTR IpCmdLine,int nCmdShow)
{
MSG msg;
if (!InitWindow(hInstance,nCmdShow)) return FALSE;
while(1)
{
if(PeekMessage(&msg,NULL,0,0,PM_REMOVE))
{
if (msg.message==WM_QUIT) break;
TranslateMessage(&msg);
DispatchMessage(&msg);
}
}
return msg.wParam;
}
static BOOL InitWindows(HINSTANCE hInstance,int nCmdShow)
{
WNDCLASS wc;
wc.style=NULL;
wc.lpfnWndProc=(WNDPROC)WinProc;
wc.cbClsExtra=0;
wc.cbWndExtra=0;
wc.hInstance=hInstance;
wc.hIcon=NULL;
wc.hCursor=NULL;
wc.hbrBackground=NULL;
wc.lpszMenuName=NULL;
wc.lpszClassName="MY_Test";
RegisterClass(&wc);
hwnd=CreateWindow("MY_Test",
"My first program",
WS_POPUP|WS_MAXIMIZE,0,0,
GetSystemMetrics(SM_CXSCREEN),
GetSystemMetrics(SM_CYSCREEN),
NULL,NULL,hInstance,NULL);
if(!hwnd) return FALSE;
ShowWindow(hwnd,nCmdShow);
UpdateWindow(hwnd);
return TRUE;
}

LRESULT CALLBACK WinProc(HWND hWnd,UINT message,WPARAM wParam,LPARAM IParam)
{
switch(message)
{
case WM_KEYDOWN:
switch(wParam)
{
case VK_ESCAPE:
MessageBox(hWnd,"ESC 健按下了!确定后退出!","Keyboard",MB_OK);
PostQuitMessage(0);
break;
}
break;
case WM_RBUTTONDOWN:
MessageBox(hWnd,"鼠标右键按下了!","Mouse",MB_OK);
break;

case WM_DESTROY:
PostQuitMessage(0);
break;
}
return DefWindowProc(hWnd,message,wParam,IParam);
}

请大侠指明,谢谢。
问题解决了
static bool Initwindows这句话里多了个s

经常是这样的,没办法。