Search code examples
windowswinapisizetitlebarsystemmenu

Get system menu width in pixels using winapi


I need to obtain the total width in pixels of the window/system menu (minimize, maximize and close) in C using basic WINAPI. I came across the WM_GETTITLEBARINFOEX message which is good for me, but unfortunately it is supported starting with Vista and my application has to support also XP and 2003. Can anyone tell me how I can make this work? Any suggestions are welcome.

Thanks in advance!


Solution

  • You say system menu, but as Adrian mentioned, WM_GETTITLEBARINFOEX retrieves information about the title bar buttons. If that's what you actually want, you can probably use GetSystemMetrics(SM_CXSIZE) on anything < Vista.

    SM_CXSIZE = The width of a button in a window caption or title bar, in pixels.