Solved

Maximize MIDI Window

Posted on 1998-11-17
13
291 Views
Last Modified: 2013-11-20
I would like to Maximize a child window in a MIDI environment. The following code works but it is not the same as maximize. I have tried calling OnSize and SetWindowPos but it doesn't work. Please supply code sample

// make the view size itself to the size of the mainframe
      pMainFrame->MDITile();
0
Comment
Question by:gdawson
[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
  • 6
  • 5
  • 2
13 Comments
 
LVL 6

Expert Comment

by:thresher_shark
ID: 1324863
Try this:

pMainFrame->SendMessage (WM_SYSCOMMAND, SC_MAXIMIZE, 0);

Does that work?
0
 

Author Comment

by:gdawson
ID: 1324864
I added the code in InitInstance. It didn't work
0
 
LVL 2

Accepted Solution

by:
wyy_cq earned 100 total points
ID: 1324865
you need to get the HWND (CWnd*) of the child window.
CMDIChildWnd* MDIGetActive( BOOL* pbMaximized = NULL ) const;
will help you .
when you get the active mdi child window CWnd*, you can call pChildWnd->ShowWindow(...);

CMDIFrameWnd::MDINext() will make the other child window active.
by this function you can browse all the child all.
 

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!

 

Author Comment

by:gdawson
ID: 1324866
Where do I put the code? I want the window to to be maximized when it first appears. I tried putting the following code in OnInitialUpdate and OnUpdate but that didn't work because there isn't an active window.

CMainFrame* pMainFrame = STATIC_DOWNCAST(CMainFrame,
                                             AfxGetMainWnd());
      CMDIChildWnd* pMDIActive = pMainFrame->MDIGetActive();
      pMDIActive->ShowWindow(SW_SHOWMAXIMIZED );

0
 
LVL 6

Expert Comment

by:thresher_shark
ID: 1324867
Oh, I see, you are asking something different from what I thought.  I thought you wanted to maximize the whole app.

Here is what you want to do.  Go to the CChildFrame::PreCreateWindow function and add

| WS_MAXIMIZE to the end of that statement.

This will make it maximize the CHILD window like you want.
0
 

Author Comment

by:gdawson
ID: 1324868
I am confused. Below is the PreCreateWindow function. Do you want me to modify the cs structure?

BOOL CChildFrame::PreCreateWindow(CREATESTRUCT& cs)
{
      // TODO: Modify the Window class or styles here by modifying
      //  the CREATESTRUCT cs

      return CMDIChildWnd::PreCreateWindow(cs);
}

0
 
LVL 6

Expert Comment

by:thresher_shark
ID: 1324869
I can understand why you're confused, I would be too if I recieved the answer I gave you.  Yes, you should modify the cs structure, like so:

cs.style |= WS_MAXIMIZE;

That should do it.  That is, it will maximize the window inside your application by default.
0
 

Author Comment

by:gdawson
ID: 1324870
That didn't work. Stepping through MS code reveals that the precreate function get called at least 2 times. In the MS create function there is a line which looks like:

          mcs.style = cs.style & ~(WS_MAXIMIZE | WS_VISIBLE);

This turns off maximize. Then a second call is made to precreate, which agains turns on maximize. BUT because the MS_VISIBLE has been turned OFF the style is ignored. This is documented by the ms statement:

        // special handling of visibility (always created invisible)
      if (cs.style & WS_VISIBLE)
      {  ...

Therefore the folowing seems to work

         cs.style |= WS_MAXIMIZE | WS_VISIBLE ;

0
 
LVL 6

Expert Comment

by:thresher_shark
ID: 1324871
Okay, I see, I am no pro at MFC.  But just out of curiousity, why did you accept "wyy_cq's" answer if it didn't work either?
0
 
LVL 6

Expert Comment

by:thresher_shark
ID: 1324872
Since there was no acceptable answer, you could have deleted the question and gotten your points back.
0
 

Author Comment

by:gdawson
ID: 1324873
Did I accept the wrong answer? I accepted only because it pointed me in the correct direction which allowed me to solve the problem. I was tempted to mark barely acceptable but I am an easy grader.
0
 
LVL 6

Expert Comment

by:thresher_shark
ID: 1324874
Oh okay, as long as it helped you somehow.  From what I have seen in the past "wyy_cq" has a habit of answering a question when he doesn't know the answer for sure.
0
 
LVL 2

Expert Comment

by:wyy_cq
ID: 1324875
thresher_shark,
you say i have a habit of answering the question.
i think i have not the habit what you said.

perhaps my answer is not correct, because i am from China.PRC i  can't get their point accuracily. and they did not declare their idea clearly.

i have developed with VC from 5 years.from 1.0 to now.
i encouter many problem just many persons encounter.
now let us browse your answer which is correct and which is have any thing to do with the question.

gdawson want to max the child window ,you teach him to max the frame window.what are you doing.
0

Featured Post

Free Tool: SSL Checker

Scans your site and returns information about your SSL implementation and certificate. Helpful for debugging and validating your SSL configuration.

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

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…
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.
Monitoring a network: how to monitor network services and why? Michael Kulchisky, MCSE, MCSA, MCP, VTSP, VSP, CCSP outlines the philosophy behind service monitoring and why a handshake validation is critical in network monitoring. Software utilized …

690 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