Calc height of title bar or client area top left?

BlitzMax Forums/BlitzMax Programming/Calc height of title bar or client area top left?

WOO, Eureka. I've done it. It didn't need pointers to rects but rather the 4 32-bit integers that make up a Rect!

Check this code out, it displays the window coords plus height and width and the client area coords plus height and width. Very useful!

Strict

Type TWindowInfo
    Field cbSize
    Field wl,wt,wr,wb 'need to inline the TRect as 4xIntegers
	Field cl,ct,cr,cb 'need to inline the TRect as 4xIntegers
'    Field rcWindow:TRect
'    Field rcClient:TRect
    Field dwStyle
    Field dwExStyle
    Field dwWindowStatus 
    Field cxWindowBorders
    Field cyWindowBorders
    Field atomWindowType:Short 'Research shows an Atom to be a 16-bit value (I hope)
    Field wCreatorVersion:Short
End Type

Type TRect
	Field L%, T%, R%, B%
End Type

Extern "win32"
	Function GetWindowInfo(hWnd%, WindowInfo: Byte Ptr)       
End Extern

Function ccGetWindowInfo:TWindowInfo(hWnd%)
	Local wi:TWindowInfo = New TWindowInfo
	wi.cbSize = SizeOf(wi)
'	wi.rcWindow = New TRect
'	wi.rcClient = New TRect
	GetWindowInfo(hwnd,wi)
	Return wi
End Function       

Graphics 800,600,0

Local wi:TWindowInfo = ccGetWindowInfo(GetActiveWindow()) 
Cls
DrawText wi.wl,0,0
DrawText wi.wr,0,20
DrawText wi.wt,0,40
DrawText wi.wb,0,60
DrawText "Window Width = "+(wi.wr-wi.wl),0,80
DrawText "Window Height = "+(wi.wb-wi.wt),0,100

DrawText wi.cl,0,200
DrawText wi.cr,0,220
DrawText wi.ct,0,240
DrawText wi.cb,0,260
DrawText "Client Width = "+(wi.cr-wi.cl),0,280
DrawText "Client Height = "+(wi.cb-wi.ct),0,300

Flip
WaitKey