[VB.NET]在VB.NET中为什么引用了金山词霸的xdictgrb.dll文件还是不能实现鼠标取词呢?

VB.NET源码-156个实用实例哦…… <script type="text/javascript"> </script> <script type="text/javascript" src="http://pagead2.googlesyndication.com/pagead/show_ads.js"> </script>
在VB.NET中为什么引用了金山词霸的xdictgrb.dll文件还是不能实现鼠标取词呢?
我在VB.NET中添加引用了金山词霸的xdictgrb.dll文件,然后直接COPY了下面这段程序但是出现了很多错误。
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


错误 1 未定义类型“IXDictGrabSink”。
     2 未定义类型“GrabProxy”。
     3 未定义类型“GrabProxy”。
4 未声明名称“XDictGrabMouse”。
     5 “Caption”不是“System.Windows.Forms.Label”的成员。
    
是不是还要添加什么定义呢?
__________________________________________________________________________
ding
__________________________________________________________________________
imports XDICTGRB

试一下
__________________________________________________________________________
你的 是vb代码,不是vb.net的 代码
给你个C#的
在金山词霸中2005中带了一个XdictGrb.dll,添加引用

using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Data;
using System.Text;
using System.Windows.Forms;
using XDICTGRB;//金山词霸组件

namespace WindowsApplication1
{
public partial class Form1 : Form,IXDictGrabSink
{
public Form1()
{
InitializeComponent();
}
private void Form1_Load(object sender, EventArgs e)
{
GrabProxy gp = new GrabProxy();
gp.GrabInterval = 1;//指抓取时间间隔
gp.GrabMode = XDictGrabModeEnum.XDictGrabMouse;//设定取词的属性
gp.GrabEnabled = true;//是否取词的属性
gp.AdviseGrab(this);
}
//接口的实现
int IXDictGrabSink.QueryWord(string WordString, int lCursorX, int lCursorY, string SentenceString, ref int lLoc, ref int lStart)
{
this.textBox1.Text = SentenceString;//鼠标所在语句
//this.textBox1.Text = SentenceString.Substring(lLoc + 1,1);//鼠标所在字符
return 1;
}
}
}
__________________________________________________________________________
oho 被楼上的说了
__________________________________________________________________________
  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值