WinAPI: Create resizable window without title bar, but with minimize/maximize/close buttons (as Firefox/Chrome/Opera)

后端 未结 3 1938
迷失自我
迷失自我 2020-12-13 00:56

If you look at the windows of the browsers Firefox, Chrome or Opera, you\'ll notice that their windows

  • have minimize/maximize/close buttons
  • are resiza
3条回答
  •  南笙
    南笙 (楼主)
    2020-12-13 01:25

    The programs remove the non-client area (the title bar) and have a bunch of custom handling for reproducing the window buttons, icons, system menu etc. The benefit of this is that they can draw to the new "title bar", which is actually part of the standard client area, adding tabs or other custom controls.

    The following two articles will show you how to do this on Vista and above (using the DWM):

    • Setting up a custom title bar on Windows Vista / 7
    • Setting up a custom title bar - reprise This one has a demo app showing the result of a number of variations / options.

    This is very complex to do and get right, so the above two articles are invaluable. The author must have put a lot of work into them! Both links have example code written in Delphi, but it should be easy enough to translate it to C++ - the concepts are identical, it's just syntax.

    You might also be interested in general resources on Glass and DWM, since it's all closely related. You'll spot the above two links included in that list :)

提交回复
热议问题