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
Solved

CFrameWnd that overlaps the Start Menu when maximized !

Posted on 1998-11-20
4
360 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

Free Tool: Site Down Detector

Helpful to verify reports of your own downtime, or to double check a downed website you are trying to access.

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

Suggested Solutions

Title # Comments Views Activity
cat dog challenge 18 126
ShiftLeft challenge 21 86
noX challenge 17 129
Thin secure Windows 10 5 102
Introduction: Finishing the grid – keyboard support for arrow keys to manoeuvre, entering the numbers.  The PreTranslateMessage function is to be used to intercept and respond to keyboard events. Continuing from the fourth article about sudoku. …
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.
I've attached the XLSM Excel spreadsheet I used in the video and also text files containing the macros used below. https://filedb.experts-exchange.com/incoming/2017/03_w12/1151775/Permutations.txt https://filedb.experts-exchange.com/incoming/201…

860 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