Solved

desktop bounderies

Posted on 2003-11-11
5
190 Views
Last Modified: 2010-05-01
How do I find out the desktop size without the toolbars (for example the the desktop size without the taskbar ?)
0
Comment
Question by:phyderous
5 Comments
 
LVL 14

Expert Comment

by:aelatik
ID: 9721813
Here you go, i just show the sizes. Make your own calculation....

Private Declare Function FindWindow Lib "user32" Alias "FindWindowA" (ByVal lpClassName As String, ByVal lpWindowName As String) 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 msg As String
    Dim Wnd As Long
    Dim TaskbarDim As RECT
    Wnd = FindWindow("Shell_TrayWnd", vbNullString)
    GetWindowRect Wnd, TaskbarDim
    msg = "Screen width  = " & Screen.Width / 15 & vbCrLf
    msg = msg & "Screen height  = " & Screen.Height / 15 & vbCrLf
    msg = msg & "Taskbar width  = " & (TaskbarDim.Right - TaskbarDim.Left) & vbCrLf
    msg = msg & "Taskbar height  = " & (TaskbarDim.Bottom - TaskbarDim.Top) & vbCrLf
    MsgBox msg
End Sub
0
 
LVL 26

Accepted Solution

by:
EDDYKT earned 125 total points
ID: 9721828
Option Explicit
Private Declare Function SystemParametersInfo Lib "user32" Alias "SystemParametersInfoA" (ByVal uAction As Long, ByVal uParam As Long, ByRef lpvParam As Any, ByVal fuWinIni As Long) As Long
Private Const SPI_GETWORKAREA = 48

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

Private rc As RECT

Private Sub Form_Load()
SystemParametersInfo SPI_GETWORKAREA, vbNull, rc, 0
Me.Move rc.Left * Screen.TwipsPerPixelX, rc.Top * _
            Screen.TwipsPerPixelY, rc.Right * _
            Screen.TwipsPerPixelX, rc.Bottom * _
            Screen.TwipsPerPixelY
End Sub
0
 
LVL 16

Expert Comment

by:Richie_Simonetti
ID: 9721839
hummm.....
screen.width, screen.height ?
0
 
LVL 16

Expert Comment

by:Richie_Simonetti
ID: 9721895
It appears that i didn't understand what you mean by "desktop size without the taskbar"
Cheers
0
 
LVL 5

Author Comment

by:phyderous
ID: 9722257
you will get your point on the previous one ... :-)
0

Featured Post

Is Your Active Directory as Secure as You Think?

More than 75% of all records are compromised because of the loss or theft of a privileged credential. Experts have been exploring Active Directory infrastructure to identify key threats and establish best practices for keeping data safe. Attend this month’s webinar to learn more.

Question has a verified solution.

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

Suggested Solutions

Title # Comments Views Activity
How to create a duplicate finder Application 9 115
Using "ScreenUpdating" 6 55
Adding to a VBA? 6 63
How to measure sizes and angles in scanned images ? 3 55
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…
Article by: Martin
Here are a few simple, working, games that you can use as-is or as the basis for your own games. Tic-Tac-Toe This is one of the simplest of all games.   The game allows for a choice of who goes first and keeps track of the number of wins for…
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…
Get people started with the process of using Access VBA to control Excel using automation, Microsoft Access can control other applications. An example is the ability to programmatically talk to Excel. Using automation, an Access application can laun…

861 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

Need Help in Real-Time?

Connect with top rated Experts

23 Experts available now in Live!

Get 1:1 Help Now