• Status: Solved
  • Priority: Medium
  • Security: Public
  • Views: 259
  • Last Modified:

Set minimum size of a window

How can I use WinAPI to set a minimize size for a window?
also, can I set a maximum size too?
0
leeal
Asked:
leeal
  • 4
  • 4
1 Solution
 
tma050898Commented:
You need to handle the WM_GETMINMAXINFO message and fill out the passed structure as to the min and max of your window.

0
 
leealAuthor Commented:
Can you give me more details?
0
 
tma050898Commented:
Actually, I need more details. What language are you using?
0
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.

 
leealAuthor Commented:
I am using VB5.
0
 
tma050898Commented:
I was afraid you were going to say that ;)

Ok. I haven't touched VB since 3.0, but believe or not, the only time I've ever used the WM_GETMINMAXINFO msg was from a VB app. When I used VB it did not provide programmers the ability to handle Windows messages. IOW, programmers could only select events from a fixed set of events for each object. Therefore, we used a product from Desaware called Spy Works in order to handle Windows messsages. So the questions are...

1. Does VB5 now allow you to directly handle Windows messages (as opposed to picking from a fixed set of events for an object)?
2. If not, do you have a product like SpyWorks or a similar competitor's product (e.g., Sheridan, MicroHelp, etc.)???

0
 
leealAuthor Commented:
1. ummm, I'm not sure. But there's an "addressof" operator that can return the address of a procedure.
2. no, I don't.
0
 
bbarberCommented:
Can you process the WM_SIZE message which is passed to any window that receives a command to resize. Then if the size requested is not within your boundries, set it to your min or max value.
0
 
tma050898Commented:
bbarber,
No. The only way to do this is by handling the WM_GETMINMAXINFO msg.  A struct is passed in this msg that has min max tracking members. Setting these will cause windows to not allow the window to be size beyond the ranges specified by the application.

The problem leeal is having is that vb doesn't allow for the handling of msgs that aren't inherently supported and presented in a static list of events. I've done what he wants to do with SpyWorks because they have a vbx and an ocx that allows vb applications to receive and process windows msgs. However, he doesn't have SpyWorks or any other tool.

leeal,
Sorry about not posting in a couple of days. It took me two days to finally found track down free tool that does what you want. It's called MsgHook and can be downloaded for free at www.download.com 

If this is the way you want to go, download it and play with it. From what I've read it will do what you need. I've never used it, but if you have any problems post a new question and I (or another expert) will help in any way we can.

Tom




0
 
leealAuthor Commented:
Thanks, Tom.
0
Question has a verified solution.

Are you are experiencing a similar issue? Get a personalized answer when you ask a related question.

Have a better answer? Share it in a comment.

Join & Write a Comment

Featured Post

Keep up with what's happening at Experts Exchange!

Sign up to receive Decoded, a new monthly digest with product updates, feature release info, continuing education opportunities, and more.

  • 4
  • 4
Tackle projects and never again get stuck behind a technical roadblock.
Join Now