Hi.
I have done errorchekcing all and that, but at SOME points in my program, MoveWindow() returns error 1400, which is invalid windowhandle. Sometimes, later in the program, it works, even i havent done anything new to the handle!
I post some relevant code, and the full code included![]()
The function which creates the window and return a handle
In the WinMain() function:Code:HWND CreateInputWindow(const char* AppName) { HWND returnHWND; WNDCLASS wndclass; wndclass.style = CS_HREDRAW | CS_VREDRAW; wndclass.cbClsExtra = 0 ; wndclass.cbWndExtra = 0 ; wndclass.lpfnWndProc = InputProc; wndclass.hIcon = NULL; wndclass.hCursor = LoadCursor (NULL, IDC_ARROW) ; wndclass.lpszMenuName = NULL; wndclass.lpszClassName = AppName; wndclass.hInstance = g_hInstance ; wndclass.hbrBackground = (HBRUSH)CreateSolidBrush(RGB(255,255,255)); if (!RegisterClass (&wndclass)) { MessageBox (NULL, TEXT ("Could not register windows class. Shutting down.."), AppName, MB_ICONERROR) ; return (HWND)NULL ; // Error, exit and return } returnHWND=CreateWindow(AppName,AppName,WS_CHILD|WS_VISIBLE,0,0,0,0,output_W,(HMENU) ID_INPUT_W,g_hInstance,NULL); if(returnHWND==NULL) { MessageBox(NULL,"Call to CreateWindow() failed", "Error", MB_OK); return (HWND) NULL; // Error, exit and return } return returnHWND; }
In the MessageProcedure:Code:input_W=CreateInputWindow(wndClassInput); ShowWindow (input_W, g_CmdShow) ; UpdateWindow (input_W) ;
return 0;Code:case WM_SIZE: if(MoveWindow(input_W,0,0,200,200,true)==0) { ReportError(GetLastError(),"MoveWindow()"); //This returns 1400... }



LinkBack URL
About LinkBacks



