Results 1 to 13 of 13

Thread: [RESOLVED] form to fill the screen,but not cover the taskbar

  1. #1

    Thread Starter
    PowerPoster isnoend07's Avatar
    Join Date
    Feb 2007
    Posts
    3,237

    Resolved [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 ?
    Waiting for a full featured smart phone with out marrying a provider
    Go Android
    Go raiders

  2. #2
    PowerPoster
    Join Date
    Jun 2001
    Location
    Trafalgar, IN
    Posts
    4,141

    Re: form to fill the screen,but not cover the taskbar

    does this work?

    Me.Move 0, 0, Screen.Width, Screen.Height

  3. #3

    Thread Starter
    PowerPoster isnoend07's Avatar
    Join Date
    Feb 2007
    Posts
    3,237

    Re: form to fill the screen,but not cover the taskbar

    Quote Originally Posted by MarkT View Post
    does this work?

    Me.Move 0, 0, Screen.Width, Screen.Height
    Thanks but no it still covers the taskbar
    Waiting for a full featured smart phone with out marrying a provider
    Go Android
    Go raiders

  4. #4
    PowerPoster
    Join Date
    Jun 2001
    Location
    Trafalgar, IN
    Posts
    4,141

    Re: form to fill the screen,but not cover the taskbar

    What about

    Me.WindowState = vbMaximized

  5. #5
    Fanatic Member
    Join Date
    Mar 2009
    Location
    vbforums
    Posts
    809

    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

  6. #6

    Thread Starter
    PowerPoster isnoend07's Avatar
    Join Date
    Feb 2007
    Posts
    3,237

    Re: form to fill the screen,but not cover the taskbar

    Already tried that, but it still covers the taskbar
    Waiting for a full featured smart phone with out marrying a provider
    Go Android
    Go raiders

  7. #7
    Fanatic Member
    Join Date
    Mar 2009
    Location
    vbforums
    Posts
    809

    Re: form to fill the screen,but not cover the taskbar

    Quote Originally Posted by isnoend07 View Post
    Already tried that, but it still covers the taskbar
    Screenshot of the above code

  8. #8

    Thread Starter
    PowerPoster isnoend07's Avatar
    Join Date
    Feb 2007
    Posts
    3,237

    Re: form to fill the screen,but not cover the taskbar

    Quote Originally Posted by janu View Post
    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
    Waiting for a full featured smart phone with out marrying a provider
    Go Android
    Go raiders

  9. #9
    PowerPoster
    Join Date
    Jan 2008
    Posts
    11,074

    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


    Anything I post is an example only and is not intended to be the only solution, the total solution nor the final solution to your request nor do I claim that it is. If you find it useful then it is entirely up to you to make whatever changes necessary you feel are adequate for your purposes.

  10. #10

    Thread Starter
    PowerPoster isnoend07's Avatar
    Join Date
    Feb 2007
    Posts
    3,237

    Re: [RESOLVED] form to fill the screen,but not cover the taskbar

    Quote Originally Posted by jmsrickland View Post
    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
    Waiting for a full featured smart phone with out marrying a provider
    Go Android
    Go raiders

  11. #11
    Default Member Bonnie West's Avatar
    Join Date
    Jun 2012
    Location
    InIDE
    Posts
    4,060

    Re: [RESOLVED] form to fill the screen,but not cover the taskbar

    Quote Originally Posted by isnoend07 View Post
    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.
    On Local Error Resume Next: If Not Empty Is Nothing Then Do While Null: ReDim i(True To False) As Currency: Loop: Else Debug.Assert CCur(CLng(CInt(CBool(False Imp True Xor False Eqv True)))): Stop: On Local Error GoTo 0
    Declare Sub CrashVB Lib "msvbvm60" (Optional DontPassMe As Any)

  12. #12
    PowerPoster
    Join Date
    Jan 2008
    Posts
    11,074

    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.


    Anything I post is an example only and is not intended to be the only solution, the total solution nor the final solution to your request nor do I claim that it is. If you find it useful then it is entirely up to you to make whatever changes necessary you feel are adequate for your purposes.

  13. #13
    Default Member Bonnie West's Avatar
    Join Date
    Jun 2012
    Location
    InIDE
    Posts
    4,060

    Re: [RESOLVED] form to fill the screen,but not cover the taskbar

    Quote Originally Posted by jmsrickland View Post
    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.
    On Local Error Resume Next: If Not Empty Is Nothing Then Do While Null: ReDim i(True To False) As Currency: Loop: Else Debug.Assert CCur(CLng(CInt(CBool(False Imp True Xor False Eqv True)))): Stop: On Local Error GoTo 0
    Declare Sub CrashVB Lib "msvbvm60" (Optional DontPassMe As Any)

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  



Click Here to Expand Forum to Full Width