Jump to content

Window title height and window border width

Recommended Posts

Here's a script snippet to find the window title height and window border width:

$winTitle="Title of window here"

$winSize = WinGetPos($winTitle)
$clientSize = WinGetClientSize($winTitle)

$borderWidth = $winSize[2] - $clientSize[0]
$winTitleHeight = $winSize[3] - $borderWidth - $clientSize[1]

I was fumbling around looking for variables or macros to get this information, but couldn't find it so made it myself. Not really sure if it's 100% accurate, but it seems to work for me in Windows XP and Vista so far :)

Link to comment
Share on other sites


$wtit = DllCall('user32.dll', 'int', 'GetSystemMetrics', 'int', $SM_CYCAPTION)
$wtit = $wtit[0] ; 19 or 26
$border = DllCall('user32.dll', 'int', 'GetSystemMetrics', 'int', $SM_CXFIXEDFRAME)
$border = $border[0] ; 3

Look at my Radar project in my signature ...

Edited by Zedna
Link to comment
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now

  • Recently Browsing   0 members

    • No registered users viewing this page.
  • Create New...