Error 2 and 183 while registering a windowe class and creatinga window.
Hi all
when i try to register a new Window Class, I get the Errors no 2 and 183
Error 2: The system cannot find the file specified.
Error 183 : Cannot create a file when that file already exists.
Following is the Code thats creatting these errors:
LRESULTCALLBACKWndProc(HWNDhwnd,UINTiMsg,
WPARAMwParam,LPARAMlParam) {
switch (iMsg) {
}
return 0;
}
int
APIENTRYWinMain(HINSTANCEhInstance,HINSTANCEhPrevInstance,
LPSTRlpCmdLine,
intnCmdShow)
{
WNDCLASSwndclass;
HMODULEhmod =GetModuleHandle(NULL);
wndclass.style = 0;
wndclass.lpfnWndProc =WndPro;
wndclass.cbClsExtra = 0;
wndclass.cbWndExtra = 0;
wndclass.hInstance =hmod;
wndclass.hIcon =NULL;
wndclass.hCursor =NULL;wndclass.hbrBackground = (HBRUSH)(COLOR_BACKGROUND+1);
wndclass.lpszMenuName =NULL;
wndclass.lpszClassName = (char *)"SK\0";
ATOMwndclassatom =RegisterClass(&wndclass);
DWORD hError1=GetLastError(); //Error : 2
WNDCLASSWndClass_info;
BOOLstatus =GetClassInfo(hInstance,
(LPCSTR)(LOWORD(wndclassatom)),
&WndClass_info);
//Status comes out to be same as the ATOM.
HWNDhWindow=CreateWindow("SK\0",
NULL,WS_VISIBLE|WS_VSCROLL|WS_MAXIMIZE|WS_THICKFRAME,
50,50,500,500,
NULL,
NULL,
hmod,
NULL);
DWORDhError=GetLastError();//Error :183
ShowWindow
(hWindow, 1);UpdateWindow(hWindow);
SetWindowText(hWindow,"This is test message");
Sleep(5000);
UnregisterClass("SK",hInstance);
return 0;
}
Any help is really appreciated.
Thanks a lot..
Sumit Chawla

