Solved

Window Resize

Posted on 2009-07-08
3
207 Views
Last Modified: 2012-05-07
Hi all,

i am working on some basic window functionality like Menus and Window Messages using "C"-Windows programming.

i want to reSize my main window to a specific size upon Selecting a Menu item.
example:- if i have a menu option " Half", "Full";
if i select "Half" -> Size of main window should be reduced to half.

(1)How can we do that?
(2)Which message should be sent to the WinProc to notify the new Window Size?

Hope you understood .


Thanks
0
Comment
Question by:kishan66
[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
3 Comments
 
LVL 9

Assisted Solution

by:JohnGaby
JohnGaby earned 20 total points
ID: 24809568
The function you use to resize (and move) windows is MoveWindow:

http://msdn.microsoft.com/en-us/library/ms633534(VS.85).aspx
0
 
LVL 33

Accepted Solution

by:
pgnatyuk earned 115 total points
ID: 24811027
BOOL bMove = ::SetWindowPos(m_hWnd, NULL,   left, top,   right - left,   bottom - top,   SWP_NOZORDER);
 In the window procedure you need to handle WM_SIZE, if you changing the window rectangle.
0
 
LVL 39

Assisted Solution

by:itsmeandnobodyelse
itsmeandnobodyelse earned 115 total points
ID: 24812103
To add to above comments:

MoveWindow can move a window and resize it.

SetWindowPos additionally can change the Z-order (means whether it is top to other windows or not).

Both want the coordinates given in *client* coordinates what is relative coordinates to the client rectangle (inner rectangle) of the parent window. If your window is a top level window screen coordinates and client coordinates are same. If not, you best call ScreenToClient function to translate coordinates you got by GetWindowRect to client coordinates.
0

Featured Post

Free Tool: Path Explorer

An intuitive utility to help find the CSS path to UI elements on a webpage. These paths are used frequently in a variety of front-end development and QA automation tasks.

One of a set of tools we're offering 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
How to build c program using make in mingw environment? 9 92
draw a Christmas tree by using a nested loop? 26 106
visual C++ 1 43
Excel formula to calculate ID # 4 43
When writing generic code, using template meta-programming techniques, it is sometimes useful to know if a type is convertible to another type. A good example of when this might be is if you are writing diagnostic instrumentation for code to generat…
Templates For Beginners Or How To Encourage The Compiler To Work For You Introduction This tutorial is targeted at the reader who is, perhaps, familiar with the basics of C++ but would prefer a little slower introduction to the more ad…
The goal of this video is to provide viewers with basic examples to understand recursion in the C programming language.
Video by: Grant
The goal of this video is to provide viewers with basic examples to understand and use nested-loops in the C programming language.

751 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