[RESOLVED] 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 ?
Re: form to fill the screen,but not cover the taskbar
does this work?
Me.Move 0, 0, Screen.Width, Screen.Height
Re: form to fill the screen,but not cover the taskbar
Quote:
Originally Posted by
MarkT
does this work?
Me.Move 0, 0, Screen.Width, Screen.Height
Thanks but no it still covers the taskbar
Re: form to fill the screen,but not cover the taskbar
What about
Me.WindowState = vbMaximized
Re: form to fill the screen,but not cover the taskbar
Use a WindowState of 0 (Normal)
Code:
Private Declare Function FindWindow Lib "user32" Alias "FindWindowA" (ByVal lpClassName As String, ByVal lpWindowName As String) As Long
Private Declare Function GetWindow Lib "user32" (ByVal hWnd As Long, ByVal wCmd As Long) As Long
Private Declare Function GetWindowRect Lib "user32" (ByVal hWnd As Long, lpRect As RECT) As Long
Private Type RECT
Left As Long
Top As Long
Right As Long
Bottom As Long
End Type
Private Sub Form_Load()
Dim r As RECT
Dim hWnd As Long
hWnd = FindWindow("Shell_traywnd", vbNullString)
GetWindowRect hWnd, r
Me.Height = Screen.Height - ((r.Bottom - r.Top) * Screen.TwipsPerPixelX)
Me.Width = Screen.Width
End Sub
Re: form to fill the screen,but not cover the taskbar
Already tried that, but it still covers the taskbar
Re: form to fill the screen,but not cover the taskbar
Quote:
Originally Posted by
isnoend07
Already tried that, but it still covers the taskbar
Screenshot of the above code
http://imageshack.com/a/img833/9380/b9sa.jpg
Re: form to fill the screen,but not cover the taskbar
Quote:
Originally Posted by
janu
Use a WindowState of 0 (Normal)
Code:
Private Declare Function FindWindow Lib "user32" Alias "FindWindowA" (ByVal lpClassName As String, ByVal lpWindowName As String) As Long
Private Declare Function GetWindow Lib "user32" (ByVal hWnd As Long, ByVal wCmd As Long) As Long
Private Declare Function GetWindowRect Lib "user32" (ByVal hWnd As Long, lpRect As RECT) As Long
Private Type RECT
Left As Long
Top As Long
Right As Long
Bottom As Long
End Type
Private Sub Form_Load()
Dim r As RECT
Dim hWnd As Long
hWnd = FindWindow("Shell_traywnd", vbNullString)
GetWindowRect hWnd, r
Me.Height = Screen.Height - ((r.Bottom - r.Top) * Screen.TwipsPerPixelX)
Me.Width = Screen.Width
End Sub
thanks that seems to work when
adding this:
Private Sub Form_Load()
Me.Left = 0
Me.Top = 0
Dim r As RECT
Dim hWnd As Long
hWnd = FindWindow("Shell_traywnd", vbNullString)
GetWindowRect hWnd, r
Me.Height = Screen.Height - ((r.Bottom - r.Top) * Screen.TwipsPerPixelX)
Me.Width = Screen.Width
setting the left and top
Re: [RESOLVED] form to fill the screen,but not cover the taskbar
It may work for you but it doesn't work for me
Me.WindowState = vbMaximized
and Taskbar set to no Auto Hide and keep Taskbar on top of other windows works best for me
Re: [RESOLVED] form to fill the screen,but not cover the taskbar
Quote:
Originally Posted by
jmsrickland
It may work for you but it doesn't work for me
Me.WindowState = vbMaximized
and Taskbar set to no Auto Hide and keep Taskbar on top of other windows works best for me
I think that may work on win7, but not xp
Re: [RESOLVED] form to fill the screen,but not cover the taskbar
Quote:
Originally Posted by
isnoend07
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 ?
I believe the code here is what you're after.
Re: [RESOLVED] form to fill the screen,but not cover the taskbar
I don't see what that does any better than using vbMaximized. On my PC the results are exactly the same.
Re: [RESOLVED] form to fill the screen,but not cover the taskbar
Quote:
Originally Posted by
jmsrickland
I don't see what that does any better than using vbMaximized. On my PC the results are exactly the same.
Based on isnoend07's OP and subsequent responses, I get the impression that maximizing the Form isn't the effect he's looking for. At any rate, it seems the OP has already found a suitable solution in post #8.