Re: Controlling default document window size
You can set a lot of things in the mainframe's PreCreateWindow() function:
bool CMainFrame::IsMinimumScreenRes()
{
bool bIsMin = false;
int width = GetSystemMetrics(SM_CXSCREEN);
int height = GetSystemMetrics(SM_CYSCREEN);
//Ensure width never less than 800;
if(width <= 800 && height <= 600)
bIsMin = true;
return bIsMin;
}
BOOL CMainFrame::PreCreateWindow(CREATESTRUCT& cs)
{
cs.style |= WS_CLIPSIBLINGS|WS_CLIPCHILDREN;
cs.style &= ~FWS_ADDTOTITLE;
cs.style &= ~WS_VISIBLE; // make window invisible at first.
//ensure width never less than 800;
if(IsMinimumScreenRes())
{
cs.cx = 800;
cs.cy = 600;
}
if( !CFrameWnd::PreCreateWindow(cs) )
return FALSE;
return TRUE;
}
Tom
"Gerhard Fiedler" <gefiedler@globo.com> wrote in message
news:OsIzRhHeIHA.5900@TK2MSFTNGP02.phx.gbl...
Hello,
I'm using VS2005 in MDI mode. It seems to open all documents with some
kind
of default width, which is much wider than useful on my monitor, and when
I
stretch the main window over several monitors, the width of the newly
opened windows becomes ridiculous.
Is there some way to control the default size of document windows? Ideally
they would open with the same size (and position) they were closed last,
but a useful constant default size would be quite helpful already.
Thanks for any pointers,
Gerhard