#include<windows.h>
LRESULT CALLBACK WndProc(HWND,UINT,WPARAM,LPARAM);
int WINAPI WinMain(HINSTANCE hinstance,HINSTANCE hPreInst,LPSTR lpszCmdLine,int nCmdShow)
{
HWND hwnd;
MSG Msg ;
WNDCLASS wndclass;
char lpszClassName[]="窗口";
char lpszTitle[]="My Windows";
wndclass.style=0;
wndclass.lpfnWndProc=WndProc;
wndclass.cbClsExtra=0;
wndclass.cbWndExtra=0;
wndclass.hInstance=hInstance ;
wndclass.hIcon=LoadIcon(NULL,IDI_APPLICATION);
wndclass.hCursor=LoadIcon(NULL,IDC_ARROW);
wndclass.hbrBackground=(HBRUSH)GetStockObject(WH
ITE_BRUSH);
wndclass.lpszMenuName=NULL;
wndclass.lpszClassName=lpszClassName;
if(!RegisterClass(&wndclass))
{
MessageBeep(0);
return FALSE;
}
hwnd=CreateWindow(
lpszClassName,
lpszTitle,
WS_OVERLAPPEDWINDOW,
CW_USEDEFAULT,
CW_USEDEFAULT,
CW_USEDEFAULT,
CW_USEDEFAULT,
NULL,
NULL,
hInstance,
NULL
);
ShowWindow(hwnd,nCmdShow);
UpdateWindow(hwnd);
while(GetMessage(&Msg,NULL,0,0))
{
TranslateMessage(&Msg);
DispatchMessage(&Msg);
}
return Msg.wParam;
}
LRESULT CALLBACK WndProc(HWND hwnd,UINT message,WPARAM wParam,LPARAM lParam)
{
switch(message)
{
case WM_DESTROY:
PostQuitMessage(0);
default:
return DefWindowProc(hwnd,message,wParam,lParam);
}
return (0);
}
wndclass.hInstance=hInstance ;
而激裂参数为
HINSTANCE hinstance
大小戚袜写写明仔闭错了。
MainWndProc 函数在孝派main前面声明一下就行了。
如:巧郑贺
LRESULT CALLBACK MainWndProc( HWND hwnd,
UINT uMsg,
WPARAM wParam,
LPARAM lParam
)
{
return S_OK;
}
把上面这个加丛派到main前面