The MASM Forum Archive 2004 to 2012

General Forums => The Campus => Topic started by: test on May 04, 2009, 02:00:38 AM

Title: Window Resizing
Post by: test on May 04, 2009, 02:00:38 AM
Hello all :bg I'm new to assembler and I've created a dialog box :U Only problem is that when I resize the window all the controls stay in there spot. They don't reposition them selves to the window. Is there a specific win32 api I can use in my window procedure? Thanks
Title: Re: Window Resizing
Post by: hutch-- on May 04, 2009, 02:32:21 AM
Yes but its not as easy as you think. You can use MoveWindow() or SetWindowPos() but you must track and size the windows yourself. You get the size with API calls like GetClientRect() or GetWindowRect() depending on what you need, calculate the size change then use MoveWindow() to change the size.

There are no API calls that automatically resize controls in a dialog or window.
Title: Re: Window Resizing
Post by: UtillMasm on May 04, 2009, 05:31:58 AM
great idea.

[attachment deleted by admin]
Title: Re: Window Resizing
Post by: test on May 04, 2009, 12:29:33 PM
Wow :green2 Good info. I was hoping for an easier way but I guess I got some reading to do. Thanks Hutch :clap:
Title: Re: Window Resizing
Post by: peaslee on May 04, 2009, 02:39:21 PM
Unless there is a reason to allow the user to resize a window, I eliminate that possibility with window style settings. I usually just allow minimizing.
Title: Re: Window Resizing
Post by: Jimg on May 04, 2009, 03:21:21 PM
Boooo.  One of my pet peeves is not being able to resize a window or popup or anything else!
Title: Re: Window Resizing
Post by: kero on May 04, 2009, 07:29:12 PM
> There are no API calls that automatically resize controls in a dialog or window

But we haveĀ  DeferWindowPos / BeginDeferWindowPos / EndDeferWindowPos
Title: Re: Window Resizing
Post by: MichaelW on May 04, 2009, 08:29:49 PM
DeferWindowPos is used to reduce the amount of work the system does in moving/resizing multiple windows. The new position and size must still be determined and passed to the function.

http://blogs.msdn.com/oldnewthing/archive/2005/07/06/436043.aspx