|
[em17]
#include<windows.h>
int WINAPI WinMain(HINSTANCE hInstance,HINSTANCE hPrevInstance,LPSTR lpCmdLine,int nCmdShow)
{
WNDCLASS win;
win.cbClsExtra=0;
win.cbWndExtra=0;
win.hbrBackground=(HBRUSH )GetStockObject(BLACK_BRUSH);
win.hCursor=LoadCursor(NULL,IDC_ARROW);
win.hIcon=LoadIcon(NULL,IDI_APPLICATION);
win.hInstance=hInstance;
win.lpfnWndProc=NULL;
win.lpszClassName="win";
win.lpszMenuName=NULL;
win.style=CS_DBLCLKS | CS_OWNDC | CS_HREDRAW | CS_VREDRAW;
RegisterClass(&win);
HWND Window=CreateWindowEx(
NULL,
"win",
"MyWindow",
WS_POPUP,
10,10,
640,480,
NULL,
NULL,
hInstance,
NULL);
ShowWindow(Window,nCmdShow);
UpdateWindow(Window);
return 0;
}
不要笑~俺现在只会写这个……
有哪位能告诉为什么我把lpfnWndProc设成NULL的时候一运行系统就会报错吗?
错误:
Unhanled exception in Mine.exe:0xC0000005:Access Violation.
还有~请问各位我在窗口为什么老是一打开就会自动CLOSE呢?
请关爱菜鸟吧~~谢谢了 [em1] |
|