set size of main application window at startup
-
Hi there, How can I set the main applicatin window to a certain size at startup? With the code below, it sizes to the set size only when the Restore button is clicked. I'd like it to be that size when the application starts up. How can I manage this? Thanks! BOOL CMainFrame::PreCreateWindow(CREATESTRUCT& cs) { if( !CMDIFrameWnd::PreCreateWindow(cs) ) return FALSE; cs.style = WS_OVERLAPPED | WS_CAPTION | WS_THICKFRAME | WS_SYSMENU | WS_MINIMIZEBOX | WS_MAXIMIZEBOX; cs.cx = 1000; cs.cy = 800; cs.x = 100; cs.y = 100; return CMDIFrameWnd::PreCreateWindow(cs); }
-
Hi there, How can I set the main applicatin window to a certain size at startup? With the code below, it sizes to the set size only when the Restore button is clicked. I'd like it to be that size when the application starts up. How can I manage this? Thanks! BOOL CMainFrame::PreCreateWindow(CREATESTRUCT& cs) { if( !CMDIFrameWnd::PreCreateWindow(cs) ) return FALSE; cs.style = WS_OVERLAPPED | WS_CAPTION | WS_THICKFRAME | WS_SYSMENU | WS_MINIMIZEBOX | WS_MAXIMIZEBOX; cs.cx = 1000; cs.cy = 800; cs.x = 100; cs.y = 100; return CMDIFrameWnd::PreCreateWindow(cs); }
-
Use the following Cwnd function, BOOL SetWindowPos( const CWnd* pWndInsertAfter, int x, int y, int cx, int cy, UINT nFlags ); Do a search on this fcn in msdn to find out more.
This function is only for child windows and popups. How can I size the main window not the child window? Thanks.
-
This function is only for child windows and popups. How can I size the main window not the child window? Thanks.
-
This function is only for child windows and popups. How can I size the main window not the child window? Thanks.
You can do that by handlling [WM_GETMINMAXINFO] message too!
"Opinions are neither right nor wrong. I cannot change your opinion. I can, however, change what influences your opinion." - David Crow
cheers, Alok Gupta