Still celebrating National IT Professionals Day with 3 months of free Premium Membership. Use Code ITDAY17

x
?
Solved

Maximize my view

Posted on 2000-02-21
9
Medium Priority
?
197 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
VIDEO: THE CONCERTO CLOUD FOR HEALTHCARE

Modern healthcare requires a modern cloud. View this brief video to understand how the Concerto Cloud for Healthcare can help your organization.

 
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

Free Tool: ZipGrep

ZipGrep is a utility that can list and search zip (.war, .ear, .jar, etc) archives for text patterns, without the need to extract the archive's contents.

One of a set of tools we're offering as a way to say 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

Introduction: Finishing the grid – keyboard support for arrow keys to manoeuvre, entering the numbers.  The PreTranslateMessage function is to be used to intercept and respond to keyboard events. Continuing from the fourth article about sudoku. …
Exception Handling is in the core of any application that is able to dignify its name. In this article, I'll guide you through the process of writing a DRY (Don't Repeat Yourself) Exception Handling mechanism, using Aspect Oriented Programming.
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.
This course is ideal for IT System Administrators working with VMware vSphere and its associated products in their company infrastructure. This course teaches you how to install and maintain this virtualization technology to store data, prevent vuln…

722 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