调用CreateWindow出错,请大虾帮忙
// TODO: Place code here.
static TCHAR szAppName[] = TEXT ("HelloWin") ;
HWND hwnd; //
MSG msg ;
WNDCLASS wndClass ;
//set the property of the object wndclass
wndClass.style = CS_HREDRAW | CS_VREDRAW;
wndClass.cbClsExtra = 0;
wndClass.cbWndExtra = 0;
wndClass.hInstance = hInstance;
wndClass.hIcon = LoadIcon(NULL,IDI_APPLICATION);
wndClass.hCursor = LoadCursor(NULL,IDC_ARROW);
wndClass.hbrBackground = (HBRUSH)GetStockObject(WHITE_BRUSH);
wndClass.lpszMenuName = NULL;
wndClass.lpszClassName = szAppName;
if( !RegisterClass(&wndClass))
{
MessageBox(NULL,TEXT("register error"),szAppName,MB_ICONERROR);
return 0;
}
static TCHAR szAppTitle[] = "Hello Window";
hwnd = CreateWindow(szAppName,
szAppTitle,
WS_OVERLAPPED | WS_MINIMIZEBOX | WS_SYSMENU,
500,
500,
544,
347,
NULL,
NULL,
hInstance,
NULL);
——————————————————————————————————
上面是在win2000+vc6。0中运行,可是一运行到CreateWindow
就出些读写错误……
hInstance其中是winmain里的参数……
访问不允许地址(就是,使用空指针)。