vb金山词霸的屏幕取词是什么原理

来源:百度知道 编辑:UC知道 时间:2024/05/04 23:52:01
金山词霸的屏幕取词是什么原理
我想用VB编个应用程序,之中有个功能,要取得鼠标指向的文字(所有窗口的),和金山词霸的屏幕取词一样的作用.
了解屏幕取词的,或有成熟构想的,把原理说一下.谢谢了.
VBplusplus :
你说得不详细啊
安装鼠标钩子,通过钩子函数获得鼠标消息。 使用到的api函数:setwindowshookex 2. 得到鼠标的当前位置,向鼠标下的窗口发重画消息,让它调用系统函数重画窗口。 使用到的api函数:windowfrompoint,screentoclient,invalidaterect 3. 截获对系统函数的调用,取得参数,也就是我们要取的词。 对于大多数的windows应用程序来说,如果要取词,我们需要截获的是“gdi32.dll”中的“textouta”函数。

前面的我还能知道啊 那个textouta 和 重画调参 我不知道怎么用 帮忙说一下

到网上下一个XdictGrb.dll,没有的话我可发给你,注册一下
如果电脑里有金山词霸,可以从里面找

Option Explicit
Implements IXDictGrabSink
Private gp As GrabProxy
Private Sub Form_Load()
Set gp = New GrabProxy
With gp
.GrabEnabled = True
.GrabInterval = 30
.GrabMode = XDictGrabMouse
.AdviseGrab Me
End With
End Sub

Private Function IXDictGrabSink_QueryWord(ByVal WordString As String, ByVal lCursorX As Long, ByVal lCursorY As Long, ByVal SentenceString As String, lLoc As Long, lStart As Long) As Long
Label1.Caption = "当前坐标:" & "(" & lCursorX & "," & lCursorY & ")"
Label2.Caption = "当前语句:" & SentenceString
Label3.Caption = "当前字符:" & Mid(SentenceString, lLoc + 1, 1)
End Function

不好意思,原理我不怎么懂,我只要求会用
你可以到下面的网址看看
http://blog.joycode.com/yaodong/articles/