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

x
?
Solved

desktop bounderies

Posted on 2003-11-11
5
Medium Priority
?
198 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
[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
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 500 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

On Demand Webinar: Networking for the Cloud Era

Did you know SD-WANs can improve network connectivity? Check out this webinar to learn how an SD-WAN simplified, one-click tool can help you migrate and manage data in the cloud.

Question has a verified solution.

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

Most everyone who has done any programming in VB6 knows that you can do something in code like Debug.Print MyVar and that when the program runs from the IDE, the value of MyVar will be displayed in the Immediate Window. Less well known is Debug.Asse…
Background What I'm presenting in this article is the result of 2 conditions in my work area: We have a SQL Server production environment but no development or test environment; andWe have an MS Access front end using tables in SQL Server but we a…
Get people started with the process of using Access VBA to control Outlook using automation, Microsoft Access can control other applications. An example is the ability to programmatically talk to Microsoft Outlook. Using automation, an Access applic…
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…
Suggested Courses

730 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