将叠加层添加到活动窗口

时间:2015-05-24 15:22:54

标签: c# .net

enter image description here

我想弄清楚C#中是否有办法将这样的叠加添加到另一个窗口的标题栏。我正在尝试制作一个监视键盘输入的程序,并根据键入的某个单词显示提示。我已经完成了其他所有工作,但是这个。

1 个答案:

答案 0 :(得分:0)

One way is to hook into the global Message Procedure with SetWindowsHookEx(WH_GETMESSAGE, ..., NULL) then in GetMsgProc() you check for WM_PAINT messages, and if the HWND is the currently top window, comparing message->hwnd with result of GetTopWindow(NULL), after that you can add your custom GDI Drawing code.

Detailed example of the Hooking DLL code can be found in the answer for this Question How to draw graphics/text on top of another application