单击“X”会发送什么事件? MFC 气球工具提示的关闭按钮?

发布于 2024-11-24 17:02:34 字数 285 浏览 1 评论 0原文

我正在开发一个非常大且复杂的 Windows 应用程序,用 C++ 编写并使用 MFC。

我正在研究这个错误,如果用户按下气球工具提示,它不会关闭,只有在超时后才会关闭。

问题是,我收到了 NIN_BALLOONUSERCLICK 事件并设法关闭了工具提示,但我似乎无法捕获用户按下右上角的“X”按钮时引发的事件。

谁能帮助我吗?我应该寻找什么事件?我花了大约三天的时间在互联网上搜索,但似乎没有人知道一种方法。

如果你能告诉我如何让“X”关闭按钮消失,那也没关系!

I am working on a very big and complex application for Windows written in C++ and using MFC.

I am working on this bug, where if a user presses on a balloon tooltip, it won't close, only after a timeout.

The thing is that I got the NIN_BALLOONUSERCLICK event and managed to close the tooltip, but I can't seem to catch the event raised when the user presses on the "X" button in the upper right corner.

Can anyone help me? What event should I look for? I've spent around 3 days of searching the Internet, but no one seems to know of a way.

If you can tell me how to make the "X" close button disappear, that would be okay, too!

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(1

盛夏尉蓝 2024-12-01 17:02:34

您找不到任何此类事件的原因是因为该事件不存在。无法区分由于用户单击了气球上的某处而关闭的气球和由于用户专门单击了关闭(“X”)按钮而关闭的气球。

更多信息可以在 Raymond Chen 博客上的这篇文章中找到:为什么当用户单击“X”按钮时通知图标没有收到消息?

基本上,该事件的存在并不是为了阻止您做坏事,例如惹恼用户。您绝对没有理由需要根据用户关闭气球通知的方式执行不同的操作。

让“X”按钮消失绝对是错误的选择。这样的要求听起来好像您就是 Windows Shell 团队试图保护我们免受侵害的开发人员。很高兴有人支持我们作为您的应用程序的毫无戒心的用户。用户喜欢能够忽略一些事情。可用性研究一再表明,当没有“取消”按钮时,用户会感到极大的压力和困惑。您需要在合理、用户友好的设计的约束下工作。

NIN_BALLOONUSERCLICK 是正确的选择。当用户单击工具提示时,该工具提示将消失。 文档更详细地解释了所有可用的通知。

The reason you can't find any such event is because one does not exist. It is not possible to distinguish between the balloon being closed because the user clicked somewhere on it and the balloon being dismissed because the user clicked specifically on the close ("X") button.

More information can be found in this article on Raymond Chen's blog: Why don't notification icons get a message when the user clicks the "X" button?

Basically, the event doesn't exist to keep you from doing bad things, like annoying your users. There's absolutely no reason that you should need to do something different based on how the user dismissed the balloon notification.

Making the "X" button disappear is definitely the wrong choice. Asking for that makes it sound like you're exactly the developer that the Windows Shell team was trying to protect us from. Glad someone has our back as unsuspecting users of your application. Users like to be able to dismiss things. Usability studies have repeatedly indicate that it's extremely stressful and confusing for users when there is no "Cancel" button. You need to work within the constraints of sensible, user-friendly design.

NIN_BALLOONUSERCLICK is the right choice. The tooltip will be dismissed when the user clicks on it. The documentation explains all of the various notifications that are available in greater detail.

~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文