Detecting height of dock and taskbar

Ken Ray kray at sonsothunder.com
Thu Sep 29 18:53:49 EDT 2005


On 9/29/05 4:32 PM, "Lynch, Jonathan" <bnz2 at cdc.gov> wrote:

> Is that API call available through VBscrpt?
> 
> If so, one could use cscript.exe from Rev to get the info.

Unfortunately, you can't do raw API calls from VBScript (AFAIK). However,
you could wrap the code in a DLL and then call it from VBScript - I do this
for other things. Here's some VB 6 code that will report the height in a
message box (make a single command button and set the form code to the
following):

-----------
Dim taskbar as Long

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

Private rc1 As RECT

Private Declare Function GetWindowRect Lib "user32" _
    (ByVal hwnd As Long, lpRect As Rect) As Long
Private Declare Function FindWindow Lib "user32" _
    (ByVal lpClassName As String, ByVal lpWindowName As String) As Long

Private Sub Command1_Click()
    Call GetWindowRect(FindWindow("Shell_traywnd",""), rc1)
    MsgBox (rc1.Bottom - rc1.Top)
End Sub
-----------

Keep in mind that some users have their task bars on the top or the left or
the right, so you'd have to check the width/height to see which is larger to
determine which orientation and where the task bar is.


Ken Ray
Sons of Thunder Software
Web site: http://www.sonsothunder.com/
Email: kray at sonsothunder.com




More information about the use-livecode mailing list