[Lazarus] GetWindowSize misleading documentation or bug?

Giuliano Colla giuliano.colla at fastwebnet.it
Fri Sep 26 19:32:06 CEST 2014


Il 26/09/2014 13:03, Luca Olivetti ha scritto:
> I was looking for a (hopefullyuuuuu) cross platform way to know the
> whole size of a window, including its decoration and I found this:
>
> http://lazarus-ccr.sourceforge.net/docs/lcl/lclintf/getwindowsize.html
>
> the documentation on that page reflect what I see on the tooltip in
> lazarus (1.2.4), *but* the implementation (at least win32) actually
> removes the size of the borders and the caption.
> Is the documentation wrong or is it a bug?
> Btw: GetWindowRect returns the whole size in windows but not with gtk2.

AFAIK getting the whole size of a window, decorations included, in a 
general way, is almost hopeless.

The entity taking care of providing borders and decoration is the window 
manager, something neither the compiler nor the widgetset are aware of.
On a given platform you may change your window manager and run the same 
program seamlessly.

Each window manager would require a specific implementation to provide 
the information, and the application should obtain the information about 
the window manager in use, to use the appropriate function, provided the 
platform makes it possible.

On Windows the task is somewhat easier, because there's just one window 
manager, but it may change from one version to the next. What works with 
Vista may not work anymore under Windows 7 or Windows 8. I tested the 
GetWindowRect function with the last stable Lazarus version in an old 
Windows XP VM, and it returns just the window client area, like it 
happens under Linux both with gtk2 and Qt.

Giuliano





More information about the Lazarus mailing list