Want to win a PS4? Go Premium and enter to win our High-Tech Treats giveaway. Enter to Win

x
?
Solved

maximize the window during startup

Posted on 1999-01-04
6
Medium Priority
?
408 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
Concerto's Cloud Advisory Services

Want to avoid the missteps to gaining all the benefits of the cloud? Learn more about the different assessment options from our Cloud Advisory team.

 
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 120 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

Free Tool: Subnet Calculator

The subnet calculator helps you design networks by taking an IP address and network mask and returning information such as network, broadcast address, and host range.

One of a set of tools we're offering as a way of saying thank you for being a part of the community.

Question has a verified solution.

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

Have you tried to learn about Unicode, UTF-8, and multibyte text encoding and all the articles are just too "academic" or too technical? This article aims to make the whole topic easy for just about anyone to understand.
Ready to get certified? Check out some courses that help you prepare for third-party exams.
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 response to a need for security and privacy, and to continue fostering an environment members can turn to for support, solutions, and education, Experts Exchange has created anonymous question capabilities. This new feature is available to our Pr…
Suggested Courses

604 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