当我的应用程序最大化时不出现自动隐藏任务栏 [英] Auto-Hide taskbar not appearing when my application is maximized

查看:37
本文介绍了当我的应用程序最大化时不出现自动隐藏任务栏的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我的应用程序绘制了自己的所有窗口边框和装饰.它适用于设置为自动隐藏的 Windows 任务栏,除非我的应用程序窗口最大化.任务栏不会卷起".如果我没有最大化应用程序,它会正常运行,即使大小一直到屏幕底部也是如此.如果我只是调整窗口大小以占据整个显示器(就像它被最大化一样),它甚至可以正常工作.

My application draws all its own window borders and decorations. It works fine with Windows taskbars that are set to auto-hide, except when my application window is maximized. The taskbar won't "roll up". It will behave normally if I have the application not maximized, even when sized all the way to the bottom of the screen. It even works normally if I just resize the window to take up the entire display (as though it was maximized).

推荐答案

我发现了问题.我的应用程序正在处理 WM_GETMINMAXINFO 消息,并覆盖参数 MINMAXINFO 记录中的值.记录中的值增加了 7(边框宽度)屏幕像素分辨率.这是有道理的,因为当最大化时,它会将窗口的边界推到屏幕的可见部分之外.它还将 ptMaxPosition(最大化时窗口原点设置的点)设置为 -7、-7.我的应用程序将其设置为 0,0,并将最大高度和宽度设置为屏幕分辨率大小(未膨胀).不知道为什么这样做;是前辈写的.如果我注释掉该代码并且不修改 MINMAXINFO 结构,则自动隐藏工作.

I found the problem. My application was handling the WM_GETMINMAXINFO message, and was overriding the values in the parameter MINMAXINFO record. The values that were in the record were inflated by 7 (border width) the screen pixel resolution. That makes sense in that when maximized, it pushes the borders of the window beyond the visible part of the screen. It also set the ptMaxPosition (point that the window origin is set to when maximized) to -7, -7. My application was setting that to 0,0, and the max height and width to exactly the screen resolution size (not inflated). Not sure why this was done; it was written by a predecessor. If I comment out that code and don't modify the MINMAXINFO structure, the Auto-hide works.

至于为什么,我不完全确定.弹出自动隐藏"任务栏的检测可能与处理 WM_MOUSEMOVE 消息的机制有关,而不是 WM_NCMOUSEMOVE.由于我的应用程序导致最大化将我的边框停在屏幕底部,我本来会生成 WM_NCMOUSEMOVE 事件;如果不考虑 MINMAXINFO,我会生成 WM_MOUSEMOVE.

As to why, I'm not entirely sure. It's possible that the detection for popping up an "autohidden" taskbar is hooked into the mechanism for handling WM_MOUSEMOVE messages, and not for WM_NCMOUSEMOVE. With my application causing the maximize to park my border right on the bottom of the screen, I would have been generating WM_NCMOUSEMOVE events; with the MINMAXINFO left alone, I would have been generating WM_MOUSEMOVE.

这篇关于当我的应用程序最大化时不出现自动隐藏任务栏的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆