?
Solved

Maximize MIDI Window

Posted on 1998-11-17
13
Medium Priority
?
293 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 200 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
Learn how to optimize MySQL for your business need

With the increasing importance of apps & networks in both business & personal interconnections, perfor. has become one of the key metrics of successful communication. This ebook is a hands-on business-case-driven guide to understanding MySQL query parameter tuning & database perf

 

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

Want to be a Web Developer? Get Certified Today!

Enroll in the Certified Web Development Professional course package to learn HTML, Javascript, and PHP. Build a solid foundation to work toward your dream job!

Question has a verified solution.

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

Introduction: Ownerdraw of the grid button.  A singleton class implentation and usage. Continuing from the fifth article about sudoku.   Open the project in visual studio. Go to the class view – CGridButton should be visible as a class.  R…
Introduction: The undo support, implementing a stack. Continuing from the eigth article about sudoku.   We need a mechanism to keep track of the digits entered so as to implement an undo mechanism.  This should be a ‘Last In First Out’ collec…
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.
If you’ve ever visited a web page and noticed a cool font that you really liked the look of, but couldn’t figure out which font it was so that you could use it for your own work, then this video is for you! In this Micro Tutorial, you'll learn yo…
Suggested Courses
Course of the Month12 days, 1 hour left to enroll

752 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