Solved

CFrameWnd that overlaps the Start Menu when maximized !

Posted on 1998-11-20
4
374 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
[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
  • 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

Industry Leaders: 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!

Question has a verified solution.

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

Here is how to use MFC's automatic Radio Button handling in your dialog boxes and forms.  Beginner programmers usually start with a OnClick handler for each radio button and that's just not the right way to go.  MFC has a very cool system for handli…
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…
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.
In this video, viewers will be given step by step instructions on adjusting mouse, pointer and cursor visibility in Microsoft Windows 10. The video seeks to educate those who are struggling with the new Windows 10 Graphical User Interface. Change Cu…

691 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