Form Resize Max - Sub Classing problem

I need to prevent a form from becoming TOO big. The form is a borderless form.

Using SubClassing, I can control the size of a form that has a borderstyle of SizeAble....

However, using the code here: http://support.microsoft.com/kb/q185733/ , a borderless form does not respond to the subclassing procedure.

What I'm looking for here is a way to prevent a borderless form from covering the taskbar when maximized. Regular subclassing will not accomplish this. What makes a borderless form different from a sizeable one, other than the border style?

I'm aware of a bug in VB that will cause borderless form to always cover the taskbar, but that is an old bug and I'm using XP with Visual Studio SP6. I would figure that bug should be fixed by now.

Using the code in the link above, can anyone here find a way to maximize a borderless form and not have it cover the taskbar???

Mugman

P.S. A quick and good answer will be boosted to 500 (2000) points.
LVL 8
mugman21Asked:
Who is Participating?
 
Erick37Connect With a Mentor Commented:
Instead of Maximizing the form, could you just use the Move() method to make the form as large as the screen?
0
 
mugman21Author Commented:
Erick37,

Thanks for making me feel dumb.... Never thought of that.... I have a usercontrol manipulating a form, I forgot I could extend the move method threw the parent property......

Problem solved, at least well enough....

I'll go ahead and give you credit here, but if you have a little spare time could you figure out why the borderless form thing listed above doesn't work?

Mugman
0
 
Erick37Commented:
I just tried the code on a borderless form, and it seems to work fine.  I am resizing the form using:
Call SendMessage(Me.hWnd, WM_NCLBUTTONDOWN, HTBOTTOMRIGHT, ByVal 0&)
and the subclassed form obeys the limits set in the MINMAXINFO structure.
0
Cloud Class® Course: MCSA MCSE Windows Server 2012

This course teaches how to install and configure Windows Server 2012 R2.  It is the first step on your path to becoming a Microsoft Certified Solutions Expert (MCSE).

 
mugman21Author Commented:
really, that is interesting....

I was trying using VB's built in functions to resize (windowstate =2 or 0), it failed. Never tried it with the sendmessage function...

What happens if you try the windowstate prop.?
0
 
Erick37Commented:
It works using the Windowstate as well.

Maximized (2), it goes upper left at the limited size
Restored (0), it restores to the previous size and location.

Perhaps try your code on a normal window to see if there is not something wrong in the subclassing code.
0
 
mugman21Author Commented:
I've tried the above subclass routine.... If the form is set to sizeable, it works great. Once I set it to borderless or a dialog form, the above subclass routine no longer functions (setting it to borderless at designtime).....

I'm using XP home edition, VS service pack 6, what are you using? This isn't making sense
0
 
Erick37Commented:
XP Pro SP2
0
 
mugman21Author Commented:
Ok, I'm going to test on a different machine with XP sp2 PRo. As I noted in the initial question, I am aware of a bug that will cause this behavior, but that bug is almost 5-6 years old. With the release of Xp and VS sp6, I would of figured the bug would be gone!!!!!! Perhaps this is yet another example of M$ dragging their as*'es.
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.

All Courses

From novice to tech pro — start learning today.