我用了金山词霸组件 ,能用行的条件,必须是安装金山词霸2007,卸掉词霸就能不运行了
我的代码如下,希望高手指点 ,卸掉后还行运行
using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Data;
using System.Drawing;
using System.Linq;
using System.Text;
using System.Windows.Forms;
using System.Reflection;
using System.Runtime.InteropServices;
using XDICTGRB;//金山词霸组件
namespace MKDB_single
{
public partial class Form_getword : Form,IXDictGrabSink
{
public Form_getword()
{
InitializeComponent();
}
//接口的实现
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;
} private void button1_Click(object sender, EventArgs e)
{
int hwnd = FindWindow("notepad", null);
hwnd = FindWindowEx(hwnd, 0, "Edit", null);
System.Text.StringBuilder str = new System.Text.StringBuilder(255);
SendMessage(hwnd, 0xD, str.Capacity, str);
MessageBox.Show(str.ToString()); } private void Form_getword_Load(object sender, EventArgs e)
{
GrabProxy gp = new GrabProxy();
gp.GrabInterval = 1;//指抓取时间间隔
gp.GrabMode = XDictGrabModeEnum.XDictGrabMouse;//设定取词的属性
gp.GrabEnabled = true;//是否取词的属性
gp.AdviseGrab(this); } }
}
我的代码如下,希望高手指点 ,卸掉后还行运行
using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Data;
using System.Drawing;
using System.Linq;
using System.Text;
using System.Windows.Forms;
using System.Reflection;
using System.Runtime.InteropServices;
using XDICTGRB;//金山词霸组件
namespace MKDB_single
{
public partial class Form_getword : Form,IXDictGrabSink
{
public Form_getword()
{
InitializeComponent();
}
//接口的实现
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;
} private void button1_Click(object sender, EventArgs e)
{
int hwnd = FindWindow("notepad", null);
hwnd = FindWindowEx(hwnd, 0, "Edit", null);
System.Text.StringBuilder str = new System.Text.StringBuilder(255);
SendMessage(hwnd, 0xD, str.Capacity, str);
MessageBox.Show(str.ToString()); } private void Form_getword_Load(object sender, EventArgs e)
{
GrabProxy gp = new GrabProxy();
gp.GrabInterval = 1;//指抓取时间间隔
gp.GrabMode = XDictGrabModeEnum.XDictGrabMouse;//设定取词的属性
gp.GrabEnabled = true;//是否取词的属性
gp.AdviseGrab(this); } }
}
http://download.csdn.net/source/216529
http://tieba.baidu.com/f?kz=89959157
XdictGrb.dll下载
要是不安装词霸在引用这个XdictGrb.dll
提示不是一个有效的程序集或组件?如何解决呢
regsvr32 *.dll