Solved

CFrameWnd that overlaps the Start Menu when maximized !

Posted on 1998-11-20
4
352 Views
Last Modified: 2013-11-20
Hi !

I created a CFrameWnd usign this code :

CreateEx(0, wClass, "test", WS_MINIMIZEBOX|WS_MAXIMIZEBOX|WS_SYSMENU|WS_THICKFRAME|WS_CLIPCHILDREN|WS_VISIBLE|WS_POPUP, 20, 20, 520, 560, NULL, NULL, NULL);

I didn't specify WS_CAPTION cause I don't want my window to have a caption.

Everything was fine until I try to maximize the window usign :

ShowWindow(SW_MAXIMIZE);

The result is weird : the window takes up all the screen, overlapping the Start Menu !!!  Is there a way I can go around that strange behavior without adding a caption to my window ?

Thanx
0
Comment
Question by:yletour
  • 2
4 Comments
 
LVL 3

Expert Comment

by:plaroche
ID: 1325056
Is WS_POPUP appropriate? Have you tried removing it?
0
 

Author Comment

by:yletour
ID: 1325057
When I remove the WS_POPUP style, my window has a caption.  But thanks for the help anyways.  I finally could find what the problem was.  I had to make a little tweak in the OnGetMinMaxInfo callback :

void CMyFrameWnd::OnGetMinMaxInfo(MINMAXINFO FAR* lpMMI)
{
      CFrameWnd::OnGetMinMaxInfo(lpMMI);

      CRect r;
      SystemParametersInfo(SPI_GETWORKAREA, 0, &r, SPIF_UPDATEINIFILE);

      lpMMI->ptMaxSize.x = r.Width();
      lpMMI->ptMaxSize.y = r.Height();
      lpMMI->ptMaxPosition.x = r.left;
      lpMMI->ptMaxPosition.y = r.top;
      
}

This does exactly what I needed !  
0
 
LVL 11

Accepted Solution

by:
mikeblas earned 50 total points
ID: 1325058
You need to handle the WM_GETMINMAXINFO message. That'll give you the opportunity to specify exactly the size you want your window to have when it's maximized.  You can measure the screen your application is on by using the GetSystemMetrics() APIs.

See the FULLY.ZIP sample at http://www.nwlink.com/~mikeblas/samples/ for a program that does both of those things.

B ekiM
0
 

Author Comment

by:yletour
ID: 1325059
Thanx, this did what I needed.
0

Featured Post

Problems using Powershell and Active Directory?

Managing Active Directory does not always have to be complicated.  If you are spending more time trying instead of doing, then it's time to look at something else. For nearly 20 years, AD admins around the world have used one tool for day-to-day AD management: Hyena. Discover why

Question has a verified solution.

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

Suggested Solutions

Title # Comments Views Activity
Expand LInux Boot partition remotly 3 90
Perl Awk Need Help 3 118
zeroMAx challenge 20 103
JQuery serialize and unserialize 8 85
Introduction: Load and Save to file, Document-View interaction inside the SDI. Continuing from the second article about sudoku.   Open the project in visual studio. From the class view select CSudokuDoc and double click to open the header …
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.
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…

809 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