Im trying to have a window size be a constant ratio so that if the user tries to resize the width of a window, it will automatically resize the height and vice versa. Is there a way to do this - for example trapping the sizing messages etc??
Im trying to have a window size be a constant ratio so that if the user tries to resize the width of a window, it will automatically resize the height and vice versa. Is there a way to do this - for example trapping the sizing messages etc??
Last edited by Mastadex; 05-23-2006 at 02:06 PM.
Founder and avid member of the Internationsl Typo Associateion
The best way I think is to disable the maximize button when you create the window. Another option may be to set the window size you want when you receive the WM_SIZE message. The MoveWindow function should do it. I am not sure if there's a better function.
silk.odyssey
Handle the window's WM_GETMINMAXINFO message - search this board if you need an example of its use as there have been several posted here in past.
CProgramming FAQ
Caution: this person may be a carrier of the misinformation virus.
WM_MINMAXINFO only allows me to set a lock for the current windows size. I have no idea if that helps me modify the width based on the height of the window....
WM_SIZE seems to work but it does not allow me to control the size of the window while the user is tryint to resize it. Its not overriding user input, and thats what I want to do.
Founder and avid member of the Internationsl Typo Associateion
WM_SIZE "is sent to a window after its size has changed". Instead, have you lookup or tried WM_SIZING? If that's not it, there's also WM_WINDOWPOSCHANGING. Not sure which one is better suited...
long time; /* know C? */
Unprecedented performance: Nothing ever ran this slow before.
Any sufficiently advanced bug is indistinguishable from a feature.
Real Programmers confuse Halloween and Christmas, because dec 25 == oct 31.
The best way to accelerate an IBM is at 9.8 m/s/s.
recursion (re - cur' - zhun) n. 1. (see recursion)
Sorry, I misread the question. WM_SIZING, as Cactus_Hugger has suggested, will do what you need.
CProgramming FAQ
Caution: this person may be a carrier of the misinformation virus.
Well this seems to trap the movement just fine. My problem is now, How do I resize the window based on what the use has done...I tried using SetWindowPos() but it didnt work as I planned. Any suggestions on what to use?
Founder and avid member of the Internationsl Typo Associateion
WM_SIZING:
Originally Posted by msdn
CProgramming FAQ
Caution: this person may be a carrier of the misinformation virus.
Hi,
in my code I handle WM_SIZING, I carefully supply correct values in WM_GETMINMAXINFO and in the end I double-check everything in WM_WINDOWPOSCHANGED and WM_SIZE for final corrections, and it all worked on both 9x and NTs, live dragging on or off, but still...
... few weeks ago I was showing my demo to some guy on HIS notebook and he seems to have XP with some skin-job or manager and he was able to maximize my window to full screen even though that window was supposed to occupy half of the screen when "maximized". Without debugger on that machine I can't tell anything, but as if my app never received some of the messages related to sizing.
Or, I don't know...
Last edited by Delf; 05-25-2006 at 09:23 AM.
If your friend is using some sort of custom window manager it may be that it doesn't properly implement the messages your application is handling.
If you want to stop an application from being maximised don't create it with the WS_MAXIMIZEBOX window creation style.
If neither of these seem likely, perhaps it might be an appropriate time to create a very simple application that reproduces the problem you are describing and post it for anyone interested enough to want to fiddle around with it.
****
>>skin-job<<
I thought replicants on earth were illegal.
CProgramming FAQ
Caution: this person may be a carrier of the misinformation virus.
He's not my friend - he was just potential customer and I hope it stays that way. Who needs friends with custom window managers?!Originally Posted by Ken Fitlike
Good idea! Maybe this weekend if I find some extra time.Originally Posted by Ken Fitlike
****
Hell, I just returned from Tannhauser Gate and you'd never guess what I saw up there?Originally Posted by Ken Fitlike