|
-
April 6th, 1999, 02:25 PM
#1
Setting the Window size
hi
in a simple SDI-Application created by the MFC-wizard, how do I set the windowsize upon the initialization of the program?
I´ve tried inserting the following commands in the CView::PreCreateWindow function:
CWnd* mywin = AfxGetMainWnd(); // Points to my only application window ( I think )
mywin->SetWindowPos(mywin, 300,300,200,100,SWP_SHOWWINDOW);
It runs ok but does not do anything at all. Where should this statement be located or what would be the correct command?
thx
-
April 6th, 1999, 03:03 PM
#2
Re: Setting the Window size
You just set the CREATESTRUCT to the disered width, hieght, and starting position :
Look up CREATESTRUCT in the msdn libraray
example:
BOOL CMainFrame::PreCreateWindow(CREATESTRUCT& cs)
{
if( !CMDIFrameWnd::PreCreateWindow(cs) )
return FALSE;
// TODO: Modify the Window class or styles here by modifying
// the CREATESTRUCT cs
cs.cx = ?;
cs.cy = ?;
cs.x = ?;
cs.y = ?;
return TRUE;
}
-
April 6th, 1999, 03:26 PM
#3
Re: Setting the Window size
You should determine the size you want before call
CWnd::PreCreateWindow
BOOL CMainFrame::PreCreateWindow(CREATESTRUCT& cs)
{
// TODO: Modify the Window class or styles here by modifying
// the CREATESTRUCT cs
cs.cx = ?;
cs.cy = ?;
cs.x = ?;
cs.y = ?;
return CFrameWnd::PreCreateWindow(cs);
}
Good luck.
Posting Permissions
- You may not post new threads
- You may not post replies
- You may not post attachments
- You may not edit your posts
-
Forum Rules
|
Click Here to Expand Forum to Full Width
|