Solved

Maximize my view

Posted on 2000-02-21
9
195 Views
Last Modified: 2013-11-20
I want to maximize my view in the start of the program. Where and how I will do this.
0
Comment
Question by:Michael Vai
[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
9 Comments
 

Expert Comment

by:pietrzak
ID: 2543634

place this function in your oncreate method or oninitdialog method depending on what type of application it is.

this->ShowWindow(SW_SHOWMAXIMIZED);
0
 

Author Comment

by:Michael Vai
ID: 2543671
i work in Document/View where i must to
place and what to maximize my view on the start of the program.
0
 
LVL 10

Expert Comment

by:RONSLOW
ID: 2544605
don't put "this->" on a call like this .. it isn't needed and just confused things.

BTW: Do you mean you want your application to be maximised, or is it a view within anb MDI app?

Either way, if you started with AppZiard, there are options for having the application and/or child windows maximised, minimised etc at startup.

Have a look at what difference these settings make to the generated application and change your application accordingly.
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 3

Expert Comment

by:akalmani
ID: 2544656
HI !!
   Hook an OnSetFocus() function handler for the view class and in that function do it like this

void CMyView::OnSetFocus()
{
   CView::OnSetFocus()
    ShowWindow(SW_SHOWMAXIMIZED);
}
0
 
LVL 4

Expert Comment

by:pagladasu
ID: 2544790
Make the following changes in the InitInstance() member function of your application class. After the line
      ParseCommandLine(cmdInfo);
add the following line
      m_nCmdShow=SW_SHOWMAXIMIZED;
then make sure the ShowWindow() function is called as follows:
      m_pMainWnd->ShowWindow(m_nCmdShow);

thanks,
pagladasu
0
 
LVL 10

Expert Comment

by:RONSLOW
ID: 2544842
Here is story...

Just followed my own advise (from my answer above)

The AppWizard makes the following things different for a maximised MDI app with maximised child windows vs a standard MDI app...

1) In CChildFrame::PreCreateWindow
adds the statement:
 
      cs.style = WS_CHILD | WS_VISIBLE | WS_OVERLAPPED | WS_CAPTION | WS_SYSMENU
            | FWS_ADDTOTITLE | WS_THICKFRAME | WS_MINIMIZEBOX | WS_MAXIMIZEBOX;

before the return true;

2) Adds the function:

void CChildFrame::ActivateFrame(int nCmdShow)
{
      // TODO: Modify this function to change how the frame is activated.

      nCmdShow = SW_SHOWMAXIMIZED;
      CMDIChildWnd::ActivateFrame(nCmdShow);
}

which is declared in the {{AFX_VIRTUAL part of the class declaration .h file as:

      virtual void ActivateFrame(int nCmdShow);

3) In CMainFrame::PreCreateWindow
adds the statement:

      cs.style = WS_OVERLAPPED | WS_CAPTION | FWS_ADDTOTITLE
            | WS_THICKFRAME | WS_SYSMENU | WS_MINIMIZEBOX | WS_MAXIMIZEBOX | WS_MAXIMIZE;

before the return TRUE;

4) In the application's InitInstance changes:
      pMainFrame->ShowWindow(m_nCmdShow);
to:
      pMainFrame->ShowWindow(SW_SHOWMAXIMIZED);

If you make similar changes to your app, then it should also be maximised.

0
 
LVL 10

Accepted Solution

by:
RONSLOW earned 20 total points
ID: 2544876
See above
0
 
LVL 10

Expert Comment

by:RONSLOW
ID: 2544879
If your's is not an MDI app, let me know and I can adjust the advice accordingly.
0
 

Author Comment

by:Michael Vai
ID: 2547643
BOOL CChildFrame::PreCreateWindow(CREATESTRUCT& cs)
{

cs.style = WS_CHILD | WS_VISIBLE | WS_OVERLAPPED | WS_CAPTION | WS_SYSMENU
| FWS_ADDTOTITLE | WS_THICKFRAME | WS_MINIMIZEBOX | WS_MAXIMIZEBOX|WS_MAXIMIZE;

      return CMDIChildWnd::PreCreateWindow(cs);
}
RONSLOW!Thank you very much.
0

Featured Post

Free Tool: Path Explorer

An intuitive utility to help find the CSS path to UI elements on a webpage. These paths are used frequently in a variety of front-end development and QA automation tasks.

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

Suggested Solutions

Title # Comments Views Activity
mapAB Challlenge 35 186
Trying to run powershell  in a batch file. How do I do this? 8 124
Excel file not created as expected 7 111
Work with App store 7 122
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…
In this post we will learn different types of Android Layout and some basics of an Android App.
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.

752 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