Solved

Maximize my view

Posted on 2000-02-21
9
194 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
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.

 
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: Site Down Detector

Helpful to verify reports of your own downtime, or to double check a downed website you are trying to access.

One of a set of tools we are providing to everyone 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
Decoding 32 bit binary streams 6 49
isEverywhere  challenge 19 84
Path of Workbook 3 86
Authenticate using sesu from script 7 60
In this article, I'll describe -- and show pictures of -- some of the significant additions that have been made available to programmers in the MFC Feature Pack for Visual C++ 2008.  These same feature are in the MFC libraries that come with Visual …
If you use Adobe Reader X it is possible you can't open OLE PDF documents in the standard. The reason is the 'save box mode' in adobe reader X. Many people think the protected Mode of adobe reader x is only to stop the write access. But this fe…
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.
Although Jacob Bernoulli (1654-1705) has been credited as the creator of "Binomial Distribution Table", Gottfried Leibniz (1646-1716) did his dissertation on the subject in 1666; Leibniz you may recall is the co-inventor of "Calculus" and beat Isaac…

821 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