如何识别GDI的类型 [英] How to recognition type of GDI

查看:96
本文介绍了如何识别GDI的类型的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

大家好,

我写了一个屏幕键盘.我得到了GDI的句柄,它通过鼠标钩子和WindowFromPoint单击它.但是我的问题是,如何获取句柄类型?

我应该是公认的可编辑组件,例如文本框或组合框或raido框等...

在此先感谢.

Hi All,

I wrote a On screen keyboard . I get handle of GDI that clicked on that by mouse hook and WindowFromPoint . But my problem is that , how to get type of handle?

I should be recognition Editable components such as text box or combo or raido box and so on ...

Thanks in Advance.

推荐答案

如果这是一个不同的应用程序,则通常是不可能的.您的虚拟键盘应该只是模仿键盘而不关心焦点.为此,您需要在低级别上模拟键盘输入.使用Windows API SendInput,请参见 http://msdn.microsoft.com /en-us/library/ms646310(v=vs.85).aspx [ http://msdn.microsoft. com/en-us/library/ff700543(v = vs.85).aspx [ http://msdn.microsoft.com/en-us/library/ms633591(v = vs.85).aspx [
You should not recognize them; and this is not generally possible if this is a different application. Your virtual keyboard should simply imitate keyboard not caring about focus. For this purpose, you need to simulate keyboard input on low-level. Use Windows API SendInput, see http://msdn.microsoft.com/en-us/library/ms646310(v=vs.85).aspx[^].

There is one delicate moment with the window of your virtual keyboard. As you type by pressing keys using the mouse, it will grab the focus from your target application. To prevent this, you need to do two changes on the window style: it should be non-focusable and always-on-top, at least when you use it. Use extended styles WS_EX_NOACTIVATE | WS_EX_TOPMOST, see .http://msdn.microsoft.com/en-us/library/ff700543(v=vs.85).aspx[^]. You can do it using Windows API SetWindowLong with the parameter nIndex = GWL_EXSTYLE, see http://msdn.microsoft.com/en-us/library/ms633591(v=vs.85).aspx[^].

—SA


我想使用GetWindowInfo()获取window的样式.控件的样式(如BS_PUSHBUTTON)的定义值在哪里?
i want to use GetWindowInfo() for getting style of window . where is defined values of Control style such as BS_PUSHBUTTON ?


这篇关于如何识别GDI的类型的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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