[2 days left] What’s wrong with your cloud strategy? Learn why multicloud solutions matter with Nimble Storage.Register Now


Disabling form sizing when borderstyle is set to 2-sizable

Posted on 2004-10-24
Medium Priority
Last Modified: 2008-03-06
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?

Question by:Gordon_Atherley
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
LVL 28

Expert Comment

ID: 12394178
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

Author Comment

ID: 12394196
Thanks vinnyd79. I'll try this and report back.
LVL 28

Accepted Solution

vinnyd79 earned 1500 total points
ID: 12394210
There is also a good example here using sub-classing:

Industry Leaders: We Want Your Opinion!

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!

LVL 32

Expert Comment

ID: 12394858
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"
LVL 23

Expert Comment

by:Ioannis Paraskevopoulos
ID: 12397552
And have the maxbutton property of the form set to false.

Author Comment

ID: 12400805
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.

Featured Post

On Demand Webinar: Networking for the Cloud Era

Ready to improve network connectivity? Watch this webinar to learn how SD-WANs and a one-click instant connect tool can boost provisions, deployment, and management of your cloud connection.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

I’ve seen a number of people looking for examples of how to access web services from VB6.  I’ve been using a test harness I built in VB6 (using many resources I found online) that I use for small projects to work out how to communicate with web serv…
When designing a form there are several BorderStyles to choose from, all of which can be classified as either 'Fixed' or 'Sizable' and I'd guess that 'Fixed Single' or one of the other fixed types is the most popular choice. I assume it's the most p…
As developers, we are not limited to the functions provided by the VBA language. In addition, we can call the functions that are part of the Windows operating system. These functions are part of the Windows API (Application Programming Interface). U…
This lesson covers basic error handling code in Microsoft Excel using VBA. This is the first lesson in a 3-part series that uses code to loop through an Excel spreadsheet in VBA and then fix errors, taking advantage of error handling code. This l…
Suggested Courses

656 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question