窗口注册失败。。//捂脸//捂脸。。今天突然莫名的想温故一下,然而怎么都注册不起来
#include <Windows.h>#define MAXI 1000;
LRESULT CALLBACK WndProc (HWND,UINT,WPARAM,LPARAM);
int WINAPI WinMain( __in HINSTANCE hInstance, __in_opt HINSTANCE hPrevInstance, __in LPSTR lpCmdLine, __in int nShowCmd )
{
HWND hWnd;
MSG msg={0};
static wchar_t str[]=TEXT("HelloWin") ;
//设计窗口类
WNDCLASSEX wndclass;
wndclass.cbSize=sizeof(WNDCLASSEX);
wndclass.style = CS_HREDRAW|CS_VREDRAW;
wndclass.lpfnWndProc=WndProc;
wndclass.cbClsExtra=0;
wndclass.cbWndExtra=0;
wndclass.hInstance=hInstance;
wndclass.hIcon=NULL;
wndclass.hCursor=LoadCursor(NULL, IDC_ARROW);
wndclass.hbrBackground=(HBRUSH)GetStockObject(WHITE_BRUSH);
wndclass.lpszMenuName=NULL;
wndclass.lpszClassName=str;
//注册窗口类
if(!RegisterClassEx(&wndclass))
{
MessageBox(NULL,L"窗口注册失败",L"消息窗口",MB_ICONERROR);
return -1;
}
//创建窗口
hWnd=CreateWindow(L"Cursor",L"Cursor",WS_OVERLAPPEDWINDOW,200,100,1000,800,NULL,NULL,hInstance,NULL);
//显示
ShowWindow(hWnd,nShowCmd);
UpdateWindow(hWnd);
while (msg.message!=WM_QUIT)
{
if (PeekMessage(&msg,hWnd,0,0,PM_NOREMOVE))
{
TranslateMessage(&msg);
DispatchMessage(&msg);
}
// else
}
return 0;
}
LRESULT CALLBACK WndProc (HWND hWnd ,UINT message,WPARAM wParam,LPARAM lParam)
{
return 0;
}