I am making a application with a borderless window on Windows. However, since the window is borderless, I have no areo shadow, snap, minimization animation, or shake. I have looked around and found no site that explains how to implement this. However, I know it is possible because Office 2013, Visual Studio 2012, and Steam all have these features and are borderless. I am specifically using QT and C++ but if you have solved this for another windowing library I would like to hear your solutions as well. either. And by areo shadow I don't mean drop shadow on two sides, I mean the glowing shadow on all sides of all active native areo windows applications.
相关问题
- Sorting 3 numbers without branching [closed]
- QML: Cannot read property 'xxx' of undefin
- How to compile C++ code in GDB?
- Why does const allow implicit conversion of refere
- thread_local variables initialization
相关文章
- ubuntu20.4中c#通过c++库调用python脚本
- 如何让cmd.exe 执行 UNICODE 文本格式的批处理?
- 怎么把Windows开机按钮通过修改注册表指向我自己的程序
- Qt槽函数自动执行多遍
- Warning : HTML 1300 Navigation occured?
- Class layout in C++: Why are members sometimes ord
- How to mock methods return object with deleted cop
- Which is the best way to multiply a large and spar
Thanks to melak47 for your answer.
For people whom are looking for a C++/Qt example, this GitHub profect does the job like a charm (thanks to deimos1877) based on melak47 code! https://github.com/deimos1877/BorderlessWindow
Be sure to use visual studio compiler (>= 2010) to get the needed DLL and it should work. This example include aerosnap support, borderless window, minimize effect, aero shadows.
After using Spy++ to inspect Steam's window (its window styles, how it replies to window messages) and trying to match everything it does, combined with the DWMAPI calls from this C# borderless window behavior, I believe I figured it out.
To hide the window's border, handle the
WM_NCCALCSIZE
message in your WindowProc:To enable the shadow, all you need to do is:
To turn it back off, restore the default margins
MARGINS windowed = {0,0,0,0};
. Perhaps throw in aSetWindowPos(hwnd, 0, 0, 0, 0, 0, SWP_NOZORDER | SWP_NOOWNERZORDER | SWP_NOACTIVATE | SWP_FRAMECHANGED | SWP_ASYNCWINDOWPOS | SWP_NOSIZE | SWP_NOMOVE );
also, to make sure the frame gets redrawn.However, this does not seem to work with all window styles, apparently your window style must not contain a titlebar.Title bars work fine, and adding one seems to enable the minimize animation.The simplest window style I got the shadow to work with was
WS_POPUP | WS_THICKFRAME
, to also get aero snap, maximizing, minimizing, and the smooth minimize animation I usedWS_POPUP | WS_THICKFRAME | WS_MINIMIZEBOX | WS_MAXIMIZEBOX | WS_CAPTION
.Changing
DWMWA_NCRENDERING_POLICY
orDWMWA_ALLOW_NCPAINT
viaDwmSetWindowAttribute
does not appear to be required, the default settings seem to work.One word of caution:
DwmExtendFrameIntoClientArea
does exactly what the name suggests, so if you are drawing an image with an alpha channel directly into your client area (say with opengl, direct3d/2d), a small frame will be visible through it:So you might have to put a non transparent widget, brush or something behind the transparent element.
If all goes well, it should then look like this:
Here is a small example project, F11 toggles borderless/windowed mode, F12 toggles the borderless shadow on and off.
I have created one that responds as photoshop.
BorderlessWindowQt-Modern-Gui