Windows 7/8屏幕覆盖VC ++ [英] Windows 7/8 Screen overlay VC++
问题描述
我正在开发一个应用程序,该应用程序将显示Windows中的OSD等东西(图形,文本等).问题是我是Windows编程的新手,找不到合适的解决方案.
I am working on an application that would display things(graphics, texts, etc) like an OSD in Windows. The problem is that I am a newbie in windows programming and I couldn't find any proper solution.
我尝试过的事情:
1:我尝试使用 WS_EX_LAYERED
标志创建一个分层的窗口:
1: I tried to create a layered window with the WS_EX_LAYERED
flag:
CreateWindowEx(WS_EX_LAYERED | WS_EX_TRANSPARENT | WS_EX_TOPMOST |WS_EX_TOOLWINDOW,szWindowClass,NULL,WS_POPUP |WS_VISIBLE |WS_SYSMENU,0、0、0、0,hWndDesktop,NULL,hInstance,NULL);
CreateWindowEx(WS_EX_LAYERED | WS_EX_TRANSPARENT | WS_EX_TOPMOST | WS_EX_TOOLWINDOW, szWindowClass, NULL, WS_POPUP | WS_VISIBLE | WS_SYSMENU, 0, 0, 0, 0, hWndDesktop, NULL, hInstance, NULL);
此方法的问题在于,一切正常,我可以在屏幕上绘制任何图像或文本,直到在其他应用程序中不处于全屏状态为止.例如播放视频.
The problem is with this approach is that everything works fine, I can draw any images or texts on the screen until I am not in fullscreen in other application. For example playing videos.
经过大量搜索后,我发现了另一个解决问题的方法:
After searching a lot I have found an other solution for my problem:
2:Direct3D
I found a code example and a good tutorial at msdn: http://msdn.microsoft.com/en-us/library/windows/desktop/dd797814(v=vs.85).aspx, but there is a problem(as always). It seems to me it uses a hardware overlay which is not supported in every graphics card. For example: ATI Radeon HD 6XXXX. But it is exactly what I need.
有人知道不需要硬件支持的适当解决方案吗?还是我做错了什么?
推荐答案
我解决了这个问题.我希望这会对某人有所帮助:
I solved the problem. I hope it will be helpful for someone:
因此,唯一的问题是在绘制完窗口后,我没有将窗口置于前景.您可以通过调用 SetWindowPos
来实现.虽然此解决方案无法在Windows 8 Metro平台上使用.
So the only problem was that i didnt bring the window to the foreground after I had drawn on it. You can do it by calling the SetWindowPos
. Altough this solution isnt working on Windows 8 metro surface.
这篇关于Windows 7/8屏幕覆盖VC ++的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!