Overlay text on some else's window - HUD

折月煮酒 提交于 2019-12-05 19:31:04
Stanislav

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.

标签
易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!