Solved

maximize the window during startup

Posted on 1999-01-04
6
393 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
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
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
Industry Leaders: We Want Your Opinion!

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!

 
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

Independent Software Vendors: We Want Your Opinion

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!

Question has a verified solution.

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

Suggested Solutions

Introduction: Hints for the grid button.  Nested classes, templated collections.  Squash that darned bug! Continuing from the sixth article about sudoku.   Open the project in visual studio. First we will finish with the SUD_SETVALUE messa…
Introduction: Database storage, where is the exe actually on the disc? Playing a game selected randomly (how to generate random numbers).  Error trapping with try..catch to help the code run even if something goes wrong. Continuing from the seve…
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.

726 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