Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations Wanet Telecoms Ltd on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Sizing - SDI

Status
Not open for further replies.

Elliott3

Programmer
Sep 5, 2002
347
CA
Hello,
How do I size the main window at runtime, through code, in an SDI that I created with the wizard...most likely I will just want to maximize the window?
Also, in the main window there is a IDD_FORMVIEW(which is shown at the begining because I added database support)...now I have added anothor IDD_FORMVIEW to the project and my question is how do I show this one in place of the original one?
Can someone help? Please.
CES
 
Hey! I just found this on the MSDN website.

Basically, they give the code on how to change the window size/attributes before the window is created. The following code goes into the "PreCreateWindow" function in the "MainFrame" class.

// Create a window without min/max buttons or sizable border. Also, start the window Maximized.
cs.style = WS_OVERLAPPED | WS_SYSMENU | WS_BORDER | WS_MAXIMIZE;

// Size the window to the screen size and position it
//at the top right of the screen
cs.cy = ::GetSystemMetrics(SM_CYSCREEN);
cs.cx = ::GetSystemMetrics(SM_CXSCREEN);
cs.y = 0;
cs.x = 0;

// Call the base-class version
return CFrameWnd::preCreateWindow(cs);

Hope this helps.
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top