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 ?
isnoend2001Asked:
Who is Participating?
 
Martin LissConnect With a Mentor Older than dirtCommented:
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
 
GrahamSkanRetiredCommented:
Have you tried:

MyForm.WindowState = vbMaximized
0
 
isnoend2001Author Commented:
Thanks : GrahamSkan, but that still covers the taskbar,
0
Get your problem seen by more experts

Be seen. Boost your question’s priority for more expert views and faster solutions

 
Martin LissOlder than dirtCommented:
Which version of Visual Basic are you using? VB6, VB.Net, VBA?
0
 
GrahamSkanRetiredCommented:
Hmm. It doesn't in my tests- Windows 7 (64) and VB6 (sp6)
0
 
isnoend2001Author Commented:
vb6(sp6)professional on xp
0
 
isnoend2001Author Commented:
Thanks
Guess the benefit of developing on xp has its benefits
0
 
Martin LissOlder than dirtCommented:
You're welcome.
0
 
Martin LissOlder than dirtCommented:
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
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.