Still celebrating National IT Professionals Day with 3 months of free Premium Membership. Use Code ITDAY17

x
?
Solved

size

Posted on 1998-10-30
3
Medium Priority
?
168 Views
Last Modified: 2010-04-02
how can i prevent the user to change the size and position of a formview based windows(visual c++ MFC).
0
Comment
Question by:saidi
[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
3 Comments
 
LVL 3

Expert Comment

by:danny_pav
ID: 1176570
1.  You could make the border not allow sizing.
or
2.  Use WM_GETMINMAXINFO
0
 
LVL 22

Accepted Solution

by:
nietod earned 150 total points
ID: 1176571
To elaborate on danny's explanations

>> You could make the border not allow sizing.

Specify a window style that does not have the WS_THICKFRAME style.  Note that some of the window styles are are made up of a a bunch of styles that are ORed toegether and might include this style without you realizing it.  For example, the WS_OVERLAPPEDWINDOW and WS_POPUPWINDOW styles both include the thick frame style.

This would prevent sizing, however the user could still move the window.  To prevent them from moving it you would also have to have a style that does not have the WS_CAPTION style.    That would produce a window without a title bar (caption).  However, I suspect you don't want that.

Another approach would be to handle the WM_WINDOWPOSCHANGING message.  This is sent to the window before it is moved and specifies the window's new position and size information.  You can adjust this information so that the window is "moved" to where it already is.  

The problem with this is that it would allow the user to try to move/resize the window with the mouse, but when they let go the window would not move or resize.  If that is a problem, you could get around it by intercepting the WM_NCHITTEST message.  And converting hits on the sizing edges (HTBOTTOM, HTBOTTOMLEFT, etc.) and hits on the caption (HTCAPTION) to HTBORDER.  (You might think this would be enough.  i.e handling this message is enough and you wouldn't need to handle the position changing message, but there are ways to resize/move the window that don't use the mouse.  handling the WM_WINDOWPOSCHANGiNG message insures that the user or orther programs can't move or resize the window using any means.
0
 
LVL 22

Expert Comment

by:nietod
ID: 1176572
Do you still need help with this?

Is this a question that was "answered" on another question.  It seems familiar.
0

Featured Post

Free Tool: ZipGrep

ZipGrep is a utility that can list and search zip (.war, .ear, .jar, etc) archives for text patterns, without the need to extract the archive's contents.

One of a set of tools we're offering as a way to say 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

Often, when implementing a feature, you won't know how certain events should be handled at the point where they occur and you'd rather defer to the user of your function or class. For example, a XML parser will extract a tag from the source code, wh…
Introduction This article is a continuation of the C/C++ Visual Studio Express debugger series. Part 1 provided a quick start guide in using the debugger. Part 2 focused on additional topics in breakpoints. As your assignments become a little more …
The goal of the video will be to teach the user the difference and consequence of passing data by value vs passing data by reference in C++. An example of passing data by value as well as an example of passing data by reference will be be given. Bot…
The viewer will learn how to pass data into a function in C++. This is one step further in using functions. Instead of only printing text onto the console, the function will be able to perform calculations with argumentents given by the user.

721 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