Solved

desktop bounderies

Posted on 2003-11-11
5
191 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

Live: Real-Time Solutions, Start Here

Receive instant 1:1 support from technology experts, using our real-time conversation and whiteboard interface. Your first 5 minutes are always free.

Question has a verified solution.

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

Suggested Solutions

Title # Comments Views Activity
Excel object stays open 19 73
How does CurrentUser work? 10 37
SLMGR Switches Are Not Working On KMS Host 3 91
Hide vba in gp 7 94
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…
If you need to start windows update installation remotely or as a scheduled task you will find this very helpful.
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…
This lesson covers basic error handling code in Microsoft Excel using VBA. This is the first lesson in a 3-part series that uses code to loop through an Excel spreadsheet in VBA and then fix errors, taking advantage of error handling code. This l…

776 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