Solved

desktop bounderies

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

Revamp Your Training Process

Drastically shorten your training time with WalkMe's advanced online training solution that Guides your trainees to action.

Question has a verified solution.

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

Suggested Solutions

If you have ever used Microsoft Word then you know that it has a good spell checker and it may have occurred to you that the ability to check spelling might be a nice piece of functionality to add to certain applications of yours. Well the code that…
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…
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…
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…

751 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