SDI Main Frame positioning?
-
I want my SDI application to have always the same size and position on screen. Resizing and Moving is disabled by the code below; which is inserted in OnCreate of main frame CMenu* pTopMenu = GetSystemMenu(FALSE); if(pTopMenu != NULL) { pTopMenu -> RemoveMenu(SC_SIZE, MF_BYCOMMAND); //No ReSize pTopMenu -> RemoveMenu(SC_MOVE, MF_BYCOMMAND); //No Move } for Resize and move above code works fine! BUT for size let us look at PreCreatewindow of Mainframe BOOL CMainFrame::PreCreateWindow(CREATESTRUCT& cs) { if( !CFrameWnd::PreCreateWindow(cs) ) return FALSE; // TODO: Modify the Window class or styles here by modifying // the CREATESTRUCT cs cs.style &= ~FWS_ADDTOTITLE; cs.x = 0; cs.y = 77; cs.cx = 1000; cs.cy = 500; return TRUE; } the above code didn't work; if i change one value in the structure the other is automatically changed/ignored, gives unexpected positioning. May be some sort of aspect ratio problem which windows might be maintaining internally. Another soloution is to use Move in the initinstance but i want to avoid it since it first shows main frame at the 0,0 position and then moves it to required postion, with a slight but observable delay. Please help to solve the above problem.