Solved

CFrameWnd that overlaps the Start Menu when maximized !

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

How to run any project with ease

Manage projects of all sizes how you want. Great for personal to-do lists, project milestones, team priorities and launch plans.
- Combine task lists, docs, spreadsheets, and chat in one
- View and edit from mobile/offline
- Cut down on emails

Join & Write a Comment

Suggested Solutions

Introduction: Dynamic window placements and drawing on a form, simple usage of windows registry as a storage place for information. Continuing from the first article about sudoku.  There we have designed the application and put a lot of user int…
Introduction: Database storage, where is the exe actually on the disc? Playing a game selected randomly (how to generate random numbers).  Error trapping with try..catch to help the code run even if something goes wrong. Continuing from the seve…
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.
This video discusses moving either the default database or any database to a new volume.

708 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

Need Help in Real-Time?

Connect with top rated Experts

18 Experts available now in Live!

Get 1:1 Help Now