Results 1 to 5 of 5

Thread: Questiong about WindowState

  1. #1

    Thread Starter
    Lively Member
    Join Date
    Nov 2005
    Location
    UK
    Posts
    87

    Resolved Questiong about WindowState

    If I choose form windowState=Maximized and BorderStyle=1. This form will cover my windows tast bar when it is running.

    What should I do to keep BorderStyle=1 and Full fill the window except for the task bar?


    Thanks
    Last edited by clear_zero; Mar 21st, 2006 at 10:19 AM.

  2. #2
    Oi, fat-rag! bushmobile's Avatar
    Join Date
    Mar 2004
    Location
    on the poop deck
    Posts
    5,592

    Re: Questiong about WindowState

    Instead of setting the windowstate to maximized, do this:

    VB Code:
    1. Option Explicit
    2.  
    3. Private Declare Function SystemParametersInfo Lib "user32" Alias "SystemParametersInfoA" ( _
    4.                 ByVal uAction As Long, _
    5.                 ByVal uParam As Long, _
    6.                 lpvParam As Any, _
    7.                 ByVal fuWinIni As Long) As Long
    8.  
    9. Private Const SPI_GETWORKAREA As Long = 48
    10.  
    11. Private Type RECT
    12.     lLeft As Long
    13.     lTop As Long
    14.     lRight As Long
    15.     lBottom As Long
    16. End Type
    17.  
    18. Private Sub Form_Load()
    19.     Dim deskRECT As RECT
    20.    
    21.     Call SystemParametersInfo(SPI_GETWORKAREA, 0&, deskRECT, 0&)
    22.    
    23.     With deskRECT
    24.         Me.Move .lLeft * Screen.TwipsPerPixelX, _
    25.                 .lTop * Screen.TwipsPerPixelX, _
    26.                 (.lRight - .lLeft) * Screen.TwipsPerPixelX, _
    27.                 (.lBottom - .lTop) * Screen.TwipsPerPixelX
    28.     End With
    29. End Sub

  3. #3

    Thread Starter
    Lively Member
    Join Date
    Nov 2005
    Location
    UK
    Posts
    87

    Re: Questiong about WindowState

    Thanks a lot

    Done

  4. #4
    Oi, fat-rag! bushmobile's Avatar
    Join Date
    Mar 2004
    Location
    on the poop deck
    Posts
    5,592

    Re: Questiong about WindowState

    Great

    I see you've added the green tick, but if you go to thread tools just above your first post and click 'Mark Thread Resolved' then it makes it even clearer. Thanks.

  5. #5
    Junior Member
    Join Date
    Dec 2011
    Posts
    20

    Question Re: Questiong about WindowState

    I have a custom TitleBar with three buttons : minimize,Maximize and close.
    For Maximize I used your code becuase I dont want my form to cover taskbar.
    The question now is How to make a form normal?
    Normal - when a user double clicks the TitleBar(windowState=VbNormal doesnt work)?

    I have created a new thread for this, please answer me on that thread :

    <URL>http://www.vbforums.com/showthread.php?p=4121865#post4121865</URL>
    Thank you.

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