在其他人的窗口上覆盖文字-HUD [英] Overlay text on some else's window - HUD

查看:132
本文介绍了在其他人的窗口上覆盖文字-HUD的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我有兴趣编写覆盖小抬头显示器的应用程序( HUD )在VB.NET中的另一个应用程序上.这样的例子是什么?

I am interested in writing an application that overlays a small heads up display (HUD) over another application, in VB.NET. What is an example of this?

我将需要枚举所有打开的窗口以找到所需的窗口,然后将一些文本覆盖在窗口上的特定位置.如果用户移动该窗口,则需要跟随我的文字. (我可能会一遍又一遍地循环绘制文本.)

I will need to enumerate all open windows to find the window that I want, and then overlay some text in a specific position on the window. If the user moves that window, my text will need to follow. (I will probably be painting the text in a loop over and over).

没有人回答我的原始查询-我在关键字中添加了C#,以查看该语言中的大师是否有答案.

nobody answered my original query - I added C# to the keywords to see if any of gurus in that language might have an answer.

推荐答案

您可以使用WinApi枚举窗口. 您可以开始使用

You can use WinApi to enumerate windows. You can start googling with

[DllImport("user32.dll")]
public static extern int EnumWindows(EnumWindowsProc ewp, int lParam);

[DllImport("user32.dll")]
[return: MarshalAs(UnmanagedType.Bool)]
public static extern bool GetWindowRect(IntPtr hWnd, ref WapiRect lpRect);

找到窗口并具有其句柄后,使用类似的东西在其上进行绘制就没问题了

When you have found your window and has its handle, there is no problem to plot on it with something like

Graphics g = Graphics.FromHwnd(win.Handle);
g.FillRectangle(new SolidBrush(Color.White), 0, 0, 1000, 1000);

但是要覆盖...一个可能的解决方案是创建自己的无边框形式(甚至可以使之透明)并将文本放置在上面.然后,只需将这种特殊形式放在另一个应用程序之上即可.

But to overlay... One possible solution is to create own border less form(it can be made even transparent) and place your text on it. Then just place this special form on top of another application.

这篇关于在其他人的窗口上覆盖文字-HUD的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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