Disabling form sizing when borderstyle is set to 2-sizable

Hello experts

In my VB6 app, which uses a status bar, setting a form to any of the fixed options (0,1,3,4) causes it to cover the Windows tray and tray and status bar. Setting it to one of the sizable options (2,5) allows the Windows tray and status bar to be visible.

The form is always set to open with WindowState = vbNormal, and with MinButton and Maxbutton set to false.

But I don't want the user to be able to size the window.  Is there any way to disable user-controlled sizing while enabling Windows to maintain the view of its tray and status bar, please?

Gordon
Gordon_AtherleyAsked:
Who is Participating?
I wear a lot of hats...

"The solutions and answers provided on Experts Exchange have been extremely helpful to me over the last few years. I wear a lot of hats - Developer, Database Administrator, Help Desk, etc., so I know a lot of things but not a lot about one thing. Experts Exchange gives me answers from people who do know a lot about one thing, in a easy to use platform." -Todd S.

vinnyd79Commented:
Have you tried setting variables in the Declarations section to hold the forms values,then checking the resize event?

Dim frmHeight As Long
Dim frmLeft As Long
Dim frmWidth As Long


Private Sub Form_Load()
frmHeight = Me.Height
frmLeft = Me.Left
frmWidth = Me.Width
End Sub

Private Sub Form_Resize()
Me.Height = frmHeight
Me.Left = frmLeft
Me.Width = frmWidth
End Sub
0
Gordon_AtherleyAuthor Commented:
Thanks vinnyd79. I'll try this and report back.
0
vinnyd79Commented:
There is also a good example here using sub-classing:

http://vbnet.mvps.org/index.html?code/subclass/minmaxinfo.htm
0

Experts Exchange Solution brought to you by

Your issues matter to us.

Facing a tech roadblock? Get the help and guidance you need from experienced professionals who care. Ask your question anytime, anywhere, with no hassle.

Start your 7-day free trial
Ultimate Tool Kit for Technology Solution Provider

Broken down into practical pointers and step-by-step instructions, the IT Service Excellence Tool Kit delivers expert advice for technology solution providers. Get your free copy now.

Erick37Commented:
Check the setting for the taskbar: Right Click the Taskbar, select Properties menu, check "Keep the Taskbar on Top of other Windows" (in VP).

Also see:

FIX: Form Covers Windows TaskBar Even If [Taskbar] Set as "Always on Top"
http://support.microsoft.com/default.aspx?scid=kb;en-us;184343
0
Ioannis ParaskevopoulosCommented:
And have the maxbutton property of the form set to false.
0
Gordon_AtherleyAuthor Commented:
Thanks to all for the advice.

Vinnyd79's subclassing solution worked for my app; the Microsoft support solution didn't.

With my form's BorderStyle set to sizable, the min and max buttons set to false, and WindowState set to maximised, I call the subclassing in the form load. The subclassing prevents the user resizing the form by dragging the borders.

Setting the borderstyle to sizable is the only way I found to stop the form covering the Windows taskbar.
0
It's more than this solution.Get answers and train to solve all your tech problems - anytime, anywhere.Try it for free Edge Out The Competitionfor your dream job with proven skills and certifications.Get started today Stand Outas the employee with proven skills.Start learning today for free Move Your Career Forwardwith certification training in the latest technologies.Start your trial today
Visual Basic Classic

From novice to tech pro — start learning today.

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.