• Status: Solved
  • Priority: Medium
  • Security: Public
  • Views: 542
  • Last Modified:

form to fill the screen,but not cover the taskbar

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 ?
0
isnoend2001
Asked:
isnoend2001
  • 4
  • 4
  • 2
1 Solution
 
GrahamSkanCommented:
Have you tried:

MyForm.WindowState = vbMaximized
0
 
isnoend2001Author Commented:
Thanks : GrahamSkan, but that still covers the taskbar,
0
 
Martin LissRetired ProgrammerCommented:
Which version of Visual Basic are you using? VB6, VB.Net, VBA?
0
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!

 
GrahamSkanCommented:
Hmm. It doesn't in my tests- Windows 7 (64) and VB6 (sp6)
0
 
isnoend2001Author Commented:
vb6(sp6)professional on xp
0
 
Martin LissRetired ProgrammerCommented:
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

0
 
isnoend2001Author Commented:
Thanks
Guess the benefit of developing on xp has its benefits
0
 
Martin LissRetired ProgrammerCommented:
You're welcome.
0
 
Martin LissRetired ProgrammerCommented:
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.
0
 
isnoend2001Author Commented:
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
0

Featured Post

Concerto's Cloud Advisory Services

Want to avoid the missteps to gaining all the benefits of the cloud? Learn more about the different assessment options from our Cloud Advisory team.

  • 4
  • 4
  • 2
Tackle projects and never again get stuck behind a technical roadblock.
Join Now