Click here to Skip to main content
15,890,579 members
Please Sign up or sign in to vote.
1.00/5 (1 vote)
See more:
I'm trying to change the maximum/minimum size of another application, and example usage of this pinvoke call in C# is surprisingly hard to find. Could someone help me?
Posted
Comments
[no name] 2-Jun-13 18:41pm    
http://www.pinvoke.net/search.aspx?search=wm_getminmaxinfo&namespace=[All]
RadXPictures 2-Jun-13 18:52pm    
I already visited that page... None of the examples actual reference specific pinvoke calls. I guess I should have been more specific... I know it is called using the WindowProc function, and I have yet to find any example code using this or related methods
[no name] 2-Jun-13 19:41pm    
Probably because WM_GETMINMAXINFO is a Windows message identifier and not a function call. So there is no way to P/Invoke it. Sounds to me that you want the SetWindowPos function or maybe even MoveWindow.
Sergey Alexandrovich Kryukov 2-Jun-13 20:50pm    
If course, this is just the Windows message ID. SendMessage/PostMessage should be invoked, and it's way too easy to find out.
But it makes no sense at all: .NET FCL does it all, but in more legitimate way. Please see my answer.
—SA
RadXPictures 2-Jun-13 22:43pm    
I checked these out, but I'm really looking for these calls to be made when a window maximize

You don't need it. Avoid using P/Invoke unless it is absolutely unavoidable, as it will kill multi-platform compatibility of your application. The .NET FCL is quite enough for solving such problem. If, for example, you are using System.Windows.Forms, all you need is this:
http://msdn.microsoft.com/en-us/library/25w4thew.aspx[^],
http://msdn.microsoft.com/en-us/library/system.windows.forms.form.maximumsize.aspx[^],
http://msdn.microsoft.com/en-us/library/system.windows.forms.form.minimumsize.aspx[^].

—SA
 
Share this answer
 
Comments
RadXPictures 2-Jun-13 22:42pm    
Okay, okay. I should probably specify a few things.

1. I am trying to change the minimum/maximum size of EXTERNAL apps (aka not my own application... ones that aren't even .NET for that matter)
2. I am trying to build an alternative shell for Windows specifically, so multiplatform compatible is not an issue for me. I don't care if it's Windows specific. It should be.
Sergey Alexandrovich Kryukov 2-Jun-13 23:37pm    
Too late. These two notes were so critical, must more serious than your original question. Now you know how important is to pose your questions accurately. Don't blame me. :-)

However, P/Invoke of such operations is not a problem at all. Wait for another answer...

—SA
Sergey Alexandrovich Kryukov 2-Jun-13 23:45pm    
Done. Please see Solution 2.

Enjoy.
—SA

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900