如何在没有 WS_EX_LAYERED 的情况下在 C++ 中制作点击窗口 [英] How to make a click-through window in C++ without WS_EX_LAYERED

查看:30
本文介绍了如何在没有 WS_EX_LAYERED 的情况下在 C++ 中制作点击窗口的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我正在尝试为名为《守望先锋》的游戏创建自定义十字准线.我当前的解决方案是创建一个位于游戏上方的最顶层窗口,同时使用 WS_EX_LAYERED 进行游戏,但是 WS_EX_LAYERED 对游戏的性能影响如此之大,以至于我认为这是一个不可行的解决方案.有没有其他方法可以让我点击我的 4x4 像素小窗口?(我已经尝试处理 WM_NCHITTEST 并返回 HTTRANSPARENT/HTNOWHERE,两者都不会导致正确点击窗口,因为它仍然会将焦点从下面的窗口移开.)

I'm trying to create a custom crosshair for a game called overwatch. My current solution is to create a topmost window that sits above the game while it plays using WS_EX_LAYERED, but WS_EX_LAYERED has such a huge performance hit to the game that I've decided it's an unviable solution. Are there any other ways I can make my tiny 4x4 pixel window click-through? (I already tried handling WM_NCHITTEST and returning HTTRANSPARENT/HTNOWHERE, both don't result in properly clicking through the window since it still takes the focus off of the window underneath.)

推荐答案

您可以为此使用区域窗口:

You can use a Region window for this:

https://msdn.microsoft.com/en-us/library/windows/desktop/dd145102(v=vs.85).aspx

这篇关于如何在没有 WS_EX_LAYERED 的情况下在 C++ 中制作点击窗口的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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