Solved

desktop bounderies

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

How to run any project with ease

Manage projects of all sizes how you want. Great for personal to-do lists, project milestones, team priorities and launch plans.
- Combine task lists, docs, spreadsheets, and chat in one
- View and edit from mobile/offline
- Cut down on emails

Join & Write a Comment

There are many ways to remove duplicate entries in an SQL or Access database. Most make you temporarily insert an ID field, make a temp table and copy data back and forth, and/or are slow. Here is an easy way in VB6 using ADO to remove duplicate row…
This article describes some techniques which will make your VBA or Visual Basic Classic code easier to understand and maintain, whether by you, your replacement, or another Experts-Exchange expert.
Get people started with the utilization of class modules. Class modules can be a powerful tool in Microsoft Access. They allow you to create self-contained objects that encapsulate functionality. They can easily hide the complexity of a process from…
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…

709 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

13 Experts available now in Live!

Get 1:1 Help Now