Solved

maximize the window during startup

Posted on 1999-01-04
6
387 Views
Last Modified: 2013-11-20
Hi,

  I am having trouble with maximizing window during startup. I have a SDI with a few splitter panes. I have overwritten CMainFrame::PreCreateWindow(CREATESTRUCT& cs) method like this:
BOOL CMainFrame::PreCreateWindow(CREATESTRUCT& cs)
{
      // TODO: Modify the Window class or styles here by modifying
      //  the CREATESTRUCT cs
      cs.style |= WS_MAXIMIZE ;
      return CFrameWnd::PreCreateWindow(cs);
}

But it DIDN'T work... May I know what's wrong with my code?

Thanks.

wyldsj
0
Comment
Question by:wyldsj
6 Comments
 
LVL 12

Expert Comment

by:migel
ID: 1327202
try call  ShowWindow(SW_SHOW); after caling CWinApp::InitInstance() in the your InitInstance

0
 

Expert Comment

by:koskia
ID: 1327203
cs.x = cs.y = 0;
cs.cx = ::GetSystemMetrics(SM_CXMAXIMIZED);
cs.cy = ::GetSystemMetrics(SM_CYMAXIMIZED);

this should do it, SM_CXMAXIMIZED and SM_CYMAXIMIZED,
are the client areas without desktop bar,
this should create a maximized window all over the desktop.
you can disable the maximize button and allow only to minimize, with changing the window style,
look at GetSystemMetrics for other coordinates, look at window styles for other styles.
0
 

Author Comment

by:wyldsj
ID: 1327204
thanks migel and koskia!
migel: In my CWinApp derived class, there is already a m_pMainWin->ShowWindow(SW_SHOW)  in the InitInstance().

koskia: After using your method, it worked! But can anyone explain why my previous code doesnot work? I am very puzzled on that... Also, koskia, please submit your comment again as answer and get the credit.

wyldsj
0
Is Your Active Directory as Secure as You Think?

More than 75% of all records are compromised because of the loss or theft of a privileged credential. Experts have been exploring Active Directory infrastructure to identify key threats and establish best practices for keeping data safe. Attend this month’s webinar to learn more.

 
LVL 1

Expert Comment

by:arunprakash
ID: 1327205
just replace the ShowWindow(nCmdShow)
as ShowWindow(SW_SHOWMAXIMIZE)
in the initinstance...that will do
thanx,
bye
arun

0
 

Accepted Solution

by:
matias103098 earned 30 total points
ID: 1327206
on your app Oninit Instance:

pMainFrame->ShowWindow(SW_SHOWMAXIMIZED);
0
 

Expert Comment

by:dagangwang
ID: 1327207
You  may  overwritten CMainFrame::ActivateFrame(int nCmdShow)  method like this:
void CMainFrame::ActivateFrame(int nCmdShow)
{
    nCmdShow = SW_SHOWMAXIMIZED;
    CFrameWnd::ActivateFrame(nCmdShow);
}

0

Featured Post

Is Your Active Directory as Secure as You Think?

More than 75% of all records are compromised because of the loss or theft of a privileged credential. Experts have been exploring Active Directory infrastructure to identify key threats and establish best practices for keeping data safe. Attend this month’s webinar to learn more.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Suggested Solutions

Title # Comments Views Activity
Adapt this command to show who installed 29 106
Folder Comparison 12 53
ODBC Connection Logging, ADO.NET 6 56
not able to insert into temp table 68 157
Introduction: Load and Save to file, Document-View interaction inside the SDI. Continuing from the second article about sudoku.   Open the project in visual studio. From the class view select CSudokuDoc and double click to open the header …
Introduction: Displaying information on the statusbar.   Continuing from the third article about sudoku.   Open the project in visual studio. Status bar – let’s display the timestamp there.  We need to get the timestamp from the document s…
This video will show you how to get GIT to work in Eclipse.   It will walk you through how to install the EGit plugin in eclipse and how to checkout an existing repository.
In this video I am going to show you how to back up and restore Office 365 mailboxes using CodeTwo Backup for Office 365. Learn more about the tool used in this video here: http://www.codetwo.com/backup-for-office-365/ (http://www.codetwo.com/ba…

911 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question

Need Help in Real-Time?

Connect with top rated Experts

25 Experts available now in Live!

Get 1:1 Help Now