早教吧 育儿知识 作业答案 考试题库 百科 知识分享

按照书上树的怎么还有两个错误呢?#includeLRESULTCALLBACKWndProc(HWND,UINT,WPARAM,LPARAM);intWINAPIWinMain(HINSTANCEhInstance,HINSTANCEhPrevInstance,LPSTRlpCmdLINE,intnShowCmd){\x05HWNDhwnd;\x05MSGmsg;\x05WNDCLASSwndclass;\x05w

题目详情
按照书上树的怎么还有两个错误呢?
#include
LRESULT CALLBACK WndProc(HWND,UINT,WPARAM,LPARAM);
int WINAPI WinMain(HINSTANCE hInstance,HINSTANCE hPrevInstance,LPSTR lpCmdLINE,int nShowCmd)
{
\x05HWND hwnd;
\x05MSG msg;
\x05WNDCLASS wndclass;
\x05wndclass.style =CS_HREDRAW|CS_VREDRAW;
\x05wndclass.lpfnWndProc =WndProc;
\x05wndclass.cbClsExtra =0;
\x05wndclass.cbWndExtra =0;
\x05wndclass.hInstance =hInstance;
\x05wndclass.hIcon =LoadIcon(NULL,IDI_APPLICATION);
\x05wndclass.hCursor =LoadCursor(NULL,IDC_ARROW);
\x05wndclass.hbrBackground =(HBRUSH)GetStockObject(WHITE_BRUSH);
\x05wndclass.lpszMenuName =NULL;
\x05wndclass.lpszClassName ="至远方";
\x05if(!RegisterClass(&wndclass))
\x05{MessageBox(NULL,"窗口注册失败!","HelloWin",0);
\x05return 0;
\x05}
\x05hwnd = CreateWindow("HelloWin","我的窗口",
\x05\x05WS_OVERLAPPEDWINDOW,
\x05\x05CW_USEDEFAULT,
\x05\x05CW_USEDEFAULT,
\x05\x05CW_USEDEFAULT,
\x05\x05CW_USEDEFAULT,
\x05\x05NULL,
\x05\x05NULL,
\x05\x05hInstance,
\x05\x05NULL);
\x05UpdateWindow(hwnd);
\x05while(GetMessage(&msg,NULL,0,0))
\x05{
\x05\x05TranslateMessage(&msg);
\x05}return msg.wParam;
}
LRESULT CALLBACK WndProc(HWND hwnd,UINT message,WPARAM wParam,LPARAM IParam)
{
\x05switch(message)
\x05{
\x05case WM_CREATE:
\x05\x05return 0;
\x05case WM_LBUTTONDOWN:
\x05\x05MessageBox(NULL,"生日快乐!@","祝福",0);
\x05\x05return 0;
\x05case WM_DESTROY:
\x05\x05PostQuitMessage(0);
\x05\x05return 0;
\x05}
\x05return DefWindowProc(hwnd,message,wParam,IParam);
}
后半截好像写错了
hInstance,
NULL);
ShowWindow (hwnd,nCmdShow);
UpdateWindow(hwnd);
while(GetMessage(&msg,NULL,0,0))
{
TranslateMessage(&msg);
ispatchMessage(&msg);
}return msg.wParam;
}
LRESULT CALLBACK WndProc(HWND hwnd,UINT message,WPARAM wParam,LPARAM IParam)
{
switch(message)
{
case WM_CREATE:
return 0;
case WM_LBUTTONDOWN:
MessageBox(NULL,"生日快乐!@","祝福",0);
return 0;
case WM_DESTROY:
PostQuitMessage(0);
return 0;
}
return DefWindowProc(hwnd,message,wParam,IParam);
}
▼优质解答
答案和解析
这么长代码,而且没有注释
没人看,
按你的错误提示
1)nCmdShow这个你的声明和使用的地方不一致,有一个地方打错了,你仔细看看
2)ispatchMessage找不到你这个函数,也就是说,如果这个函数是库 函数,你没包含进来,要么就包含敲错了;
如果这个函数是你定义的,你声明函数,使用函数,定义函数的3个地方输入的不一致,自己看看
没看代码,我c也就学个基础,只能从基础给你分析下
看了 按照书上树的怎么还有两个错误...的网友还看了以下: