form to fill the screen,but not cover the taskbar

Posted on 2014-02-01
Last Modified: 2014-02-02
I have a form I want to fill the whole screen, but not cover the taskbar.
I realize the taskbar could be on the top, bottom or sides.
How to write this ?
Question by:isnoend2001
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
  • 4
  • 4
  • 2
LVL 76

Expert Comment

ID: 39827391
Have you tried:

MyForm.WindowState = vbMaximized

Author Comment

ID: 39827732
Thanks : GrahamSkan, but that still covers the taskbar,
LVL 47

Expert Comment

by:Martin Liss
ID: 39827774
Which version of Visual Basic are you using? VB6, VB.Net, VBA?
Independent Software Vendors: 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 76

Expert Comment

ID: 39827777
Hmm. It doesn't in my tests- Windows 7 (64) and VB6 (sp6)

Author Comment

ID: 39827790
vb6(sp6)professional on xp
LVL 47

Accepted Solution

Martin Liss earned 500 total points
ID: 39827803
I agree with Graham, but this will work too.

Option Explicit

Private Const SPI_GETWORKAREA = 48
Private Declare Function SystemParametersInfo& Lib "User32" Alias "SystemParametersInfoA" ( _
ByVal uAction As Long, _
ByVal uParam As Long, lpvParam As Any, _
ByVal fuWinIni As Long)

Private Type RECT
  Left As Long
  Top As Long
  Right As Long
  Bottom As Long
End Type

Public Function FillScreen(frm As Form)
    Dim rectDesktop As RECT
    Call SystemParametersInfo(SPI_GETWORKAREA, 0, rectDesktop, 0)

    With Form1
        .Left = rectDesktop.Left * Screen.TwipsPerPixelX
        .Height = (rectDesktop.Bottom - rectDesktop.Top) * Screen.TwipsPerPixelY
        .Width = (rectDesktop.Right - rectDesktop.Left) * Screen.TwipsPerPixelX
        .Top = rectDesktop.Top * Screen.TwipsPerPixelY
    End With
End Function

Private Sub Form_Load()
FillScreen Form1
End Sub

Open in new window


Author Closing Comment

ID: 39827835
Guess the benefit of developing on xp has its benefits
LVL 47

Expert Comment

by:Martin Liss
ID: 39827856
You're welcome.
LVL 47

Expert Comment

by:Martin Liss
ID: 39827909
isnoend2001, just out of curiosity, is your form borderless? If it is then that would explain why Graham's suggestion didn't work for you.

Author Comment

ID: 39827926
No the form is not bordeless, but i plan on making one bordeless to act as a background
for smaller forms. I will post a question for this

Featured Post

Free Tool: SSL Checker

Scans your site and returns information about your SSL implementation and certificate. Helpful for debugging and validating your SSL configuration.

One of a set of tools we are providing to everyone as a way of saying thank you for being a part of the community.

Question has a verified solution.

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

Enums (shorthand for ‘enumerations’) are not often used by programmers but they can be quite valuable when they are.  What are they? An Enum is just a type of variable like a string or an Integer, but in this case one that you create that contains…
If you need to start windows update installation remotely or as a scheduled task you will find this very helpful.
Get people started with the process of using Access VBA to control Outlook using automation, Microsoft Access can control other applications. An example is the ability to programmatically talk to Microsoft Outlook. Using automation, an Access applic…
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…

738 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