#include<windows.h>
#include <tchar.h>
LRESULT CALLBACK MyWndProc(
HWND hwnd, // handle to window
UINT uMsg, // message identifier
WPARAM wParam, // first message parameter
LPARAM lParam // second message parameter
);
int WINAPI WinMain( __in HINSTANCE hInstance, __in_opt HINSTANCE hPrevInstance, __in LPSTR lpCmdLine, __in int nShowCmd )
{
WNDCLASS wnd;
HWND hwnd;
MSG msg;
wnd.style=CS_VREDRAW|CS_HREDRAW;
wnd.lpfnWndProc=MyWndProc;
wnd.cbClsExtra=0;
wnd.cbWndExtra=0;
wnd.hIcon=LoadIcon(NULL,IDI_APPLICATION);
wnd.hCursor=LoadCursor(NULL,IDC_ARROW);
wnd.hbrBackground=(HBRUSH)GetStockObject(WHITE_BRUSH);
wnd.lpszMenuName=NULL;
wnd.lpszClassName=TEXT("第一個視窗");
wnd.hInstance=hInstance;
if(!RegisterClass(&wnd))
{
MessageBox(NULL,TEXT("1111"),TEXT("222"),0);
return 0;
}
hwnd=CreateWindow(TEXT("第一個視窗"),
TEXT("我的視窗"),
WS_OVERLAPPEDWINDOW,
0,0,400,300,NULL,NULL,hInstance,NULL
);
ShowWindow(hwnd,nShowCmd);
while(GetMessage(&msg,NULL,0,0))
{
TranslateMessage(&msg);
DispatchMessage(&msg);
}
return msg.lParam;
}
LRESULT CALLBACK WindowProc(
HWND hwnd, // handle to window
UINT uMsg, // message identifier
WPARAM wParam, // first message parameter
LPARAM lParam // second message parameter
)
{
return DefWindowProc(hwnd,uMsg,wParam,lParam);
}
編譯后提示 無法決議的外部符號 ",應該加什么頭檔案嗎?照著教材抄的啊。知道的大神指點一下謝謝。
uj5u.com熱心網友回復:
具體是哪個無法鏈接?uj5u.com熱心網友回復:
用的中文的逗號吧?換成英文的試試uj5u.com熱心網友回復:
MyWndProc這個回呼函式的實作去哪了?轉載請註明出處,本文鏈接:https://www.uj5u.com/gongcheng/82932.html
標籤:基礎類
上一篇:圖示和選單資源疑問
