Still celebrating National IT Professionals Day with 3 months of free Premium Membership. Use Code ITDAY17

x
?
Solved

vbMAXIMIZE

Posted on 2001-06-25
3
Medium Priority
?
328 Views
Last Modified: 2012-05-04
I have a command button on a form with the following code in it

me.windowstate = 2 'this maximizes the form

the problem is that it maximizez the form to the screen height and witdth and covers the taskbar how can i prevent this from happening
0
Comment
Question by:RYMENHOUT
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
3 Comments
 
LVL 8

Expert Comment

by:Dave_Greene
ID: 6224630
I've seen this type of problem before.  You most likely need to change the size of the form in the development environment.  Make the form smaller (smaller than the current window size) and try it again.

cheers
0
 
LVL 22

Expert Comment

by:rspahitz
ID: 6224955
I think if you add a system object, one of the methods is the screensize excluding the taskbar, so you can simply resize your app to those settings.
0
 
LVL 2

Accepted Solution

by:
egsemsem earned 150 total points
ID: 6230556
Hi,
  try this code, it will give u the left, top,width and height of windows taskbar:

'In module
Option Explicit

Public Declare Function SHAppBarMessage Lib "shell32.dll" (ByVal dwMessage As Long, pData As APPBARDATA) As Long

Public Type RECT
    Left As Long
    Top As Long
    Right As Long
    Bottom As Long
End Type


Public Type APPBARDATA
    cbSize As Long
    hwnd As Long
    uCallbackMessage As Long
    uEdge As Long
    Rc As RECT
    lParam As Long ' message specific
End Type
Public Const ABM_GETTASKBARPOS = &H5

Public Function GetScreenRect(hwnd As Long) As RECT
    Dim enuAPPBARDATA As APPBARDATA
       
    enuAPPBARDATA.cbSize = Len(enuAPPBARDATA)
    enuAPPBARDATA.hwnd = hwnd
       
    SHAppBarMessage ABM_GETTASKBARPOS, enuAPPBARDATA
       
    With enuAPPBARDATA.Rc
        'transform to twips
        GetScreenRect.Left = .Left * Screen.TwipsPerPixelX
        GetScreenRect.Top = .Top * Screen.TwipsPerPixelY
        GetScreenRect.Right = .Right * Screen.TwipsPerPixelX
        GetScreenRect.Bottom = .Bottom * Screen.TwipsPerPixelY
    End With

End Function


'In form
Private Sub Form_Click()
    Debug.Print "left: " & GetScreenRect(Me.hwnd).Left
    Debug.Print "top: " & GetScreenRect(Me.hwnd).Top
    Debug.Print "Width: " & GetScreenRect(Me.hwnd).Right - GetScreenRect(Me.hwnd).Left
    Debug.Print "Height: " & GetScreenRect(Me.hwnd).Bottom - GetScreenRect(Me.hwnd).Top
End Sub




0

Featured Post

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!

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Introduction In a recent article (http://www.experts-exchange.com/A_7811-A-Better-Concatenate-Function.html) for the Excel community, I showed an improved version of the Excel Concatenate() function.  While writing that article I realized that no o…
Introduction While answering a recent question (http://www.experts-exchange.com/Q_27402310.html) in the VB classic zone, I wrote some VB code in the (Office) VBA environment, rather than fire up my older PC.  I didn't post completely correct code o…
As developers, we are not limited to the functions provided by the VBA language. In addition, we can call the functions that are part of the Windows operating system. These functions are part of the Windows API (Application Programming Interface). U…
Show developers how to use a criteria form to limit the data that appears on an Access report. It is a common requirement that users can specify the criteria for a report at runtime. The easiest way to accomplish this is using a criteria form that a…
Suggested Courses

670 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question