View Full Version : window title bar

21st September 2006, 16:37

I want to know if there is a way to define the height of the title bar. I want it to be as big as it is in WindowsXP theme (in windows). I know that I won't be able to achieve this from qt commands, but through native windows controls. Does anyone know how to handle this ??

21st September 2006, 16:57
Check this thread (http://www.qtcentre.org/forum/f-qt-programming-2/t-window-style-3692.html).

It's kind of "global" setting in Windows. Modify the value and it affects ALL title bars. Have you ever seen different programs having title bars with different heights? The only exception is programs which use custom (fake) title bars.

21st September 2006, 17:30
Ok. I'll try another aproach then. How can I retrieve the information about the height of the title bar. I saw a function

BOOL GetTitleBarInfo( HWND hWnd
) const;

but I don't know how to use the PTITLEBARINFO pti part, I have the HWND hWnd defined and using it, but the other PTITLEBARINFO confuses me. I saw in the MSDN what it does. I just don't know how to implement the pointer to that structure.

21st September 2006, 17:35
Check how QStyle::pixelMetric(QStyle::PM_TitleBarHeight) is implemented in QWindowsStyle and/or QWindowsXPStyle, maybe they use native winapi methods to retrieve title bar height.

21st September 2006, 17:56
Ok. Tnx, I have solved the problem.
If anyone wants to know how : (I used this function which return the height od the title bar)

int titleBarHeight = GetSystemMetrics(SM_CYSMCAPTION) - 1;