Solved

Maximize my view

Posted on 2000-02-21
9
190 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
Comment Utility

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
Comment Utility
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
Comment Utility
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
 
LVL 3

Expert Comment

by:akalmani
Comment Utility
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
Find Ransomware Secrets With All-Source Analysis

Ransomware has become a major concern for organizations; its prevalence has grown due to past successes achieved by threat actors. While each ransomware variant is different, we’ve seen some common tactics and trends used among the authors of the malware.

 
LVL 4

Expert Comment

by:pagladasu
Comment Utility
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
Comment Utility
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
Comment Utility
See above
0
 
LVL 10

Expert Comment

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

Author Comment

by:Michael Vai
Comment Utility
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

Find Ransomware Secrets With All-Source Analysis

Ransomware has become a major concern for organizations; its prevalence has grown due to past successes achieved by threat actors. While each ransomware variant is different, we’ve seen some common tactics and trends used among the authors of the malware.

Join & Write a Comment

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…
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 video demonstrates how to create an example email signature rule for a department in a company using CodeTwo Exchange Rules. The signature will be inserted beneath users' latest emails in conversations and will be displayed in users' Sent Items…

772 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

Need Help in Real-Time?

Connect with top rated Experts

10 Experts available now in Live!

Get 1:1 Help Now