Go Premium for a chance to win a PS4. Enter to Win

x
?
Solved

Maximize my view

Posted on 2000-02-21
9
Medium Priority
?
198 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
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
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!

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

[Webinar] Cloud and Mobile-First Strategy

Maybe you’ve fully adopted the cloud since the beginning. Or maybe you started with on-prem resources but are pursuing a “cloud and mobile first” strategy. Getting to that end state has its challenges. Discover how to build out a 100% cloud and mobile IT strategy in this webinar.

Question has a verified solution.

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

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 Micro Tutorial will teach you how to add a cinematic look to any film or video out there. There are very few simple steps that you will follow to do so. This will be demonstrated using Adobe Premiere Pro CS6.
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.
Suggested Courses

885 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