unit quci;interfaceuses
Windows, Messages, SysUtils, Variants, Classes, Graphics, Controls, Forms,
Dialogs, StdCtrls, OleServer, XDICTGRB_TLB;type
TForm1 = class(TForm,IXDictGrabSink) mmo1: TMemo;
GrabProxy1: TGrabProxy;procedure FormCreate(Sender: TObject);
private
{ Private declarations }
public
{ Public declarations }
function QueryWord(const WordString: WideString;lCursorX: Integer;
lCursorY: Integer;const SentenceString: WideString;
var lLoc: Integer; var lStart: Integer): Integer; safecall;
end; var
Form1: TForm1; implementation{$R *.dfm}procedure TForm1.FormCreate(Sender: TObject);
begin
GrabProxy1.GrabInterval :=1;
GrabProxy1.GrabMode :=XDictGrabMouse;
GrabProxy1.GrabEnabled :=true;
GrabProxy1.AdviseGrab(self);
end;function TForm1.QueryWord(const WordString: WideString; lCursorX,
lCursorY: Integer; const SentenceString: WideString; var lLoc,
lStart: Integer): Integer;
begin
mmo1.Text := mmo1.text+SentenceString+#13#10;
end;
end.我写了这一个小程序,做屏幕取词用的,在ie,txt都能生效,不过为什么在一个用VF做的软件就不能截取呢??是不是VF有特别的接口?
Windows, Messages, SysUtils, Variants, Classes, Graphics, Controls, Forms,
Dialogs, StdCtrls, OleServer, XDICTGRB_TLB;type
TForm1 = class(TForm,IXDictGrabSink) mmo1: TMemo;
GrabProxy1: TGrabProxy;procedure FormCreate(Sender: TObject);
private
{ Private declarations }
public
{ Public declarations }
function QueryWord(const WordString: WideString;lCursorX: Integer;
lCursorY: Integer;const SentenceString: WideString;
var lLoc: Integer; var lStart: Integer): Integer; safecall;
end; var
Form1: TForm1; implementation{$R *.dfm}procedure TForm1.FormCreate(Sender: TObject);
begin
GrabProxy1.GrabInterval :=1;
GrabProxy1.GrabMode :=XDictGrabMouse;
GrabProxy1.GrabEnabled :=true;
GrabProxy1.AdviseGrab(self);
end;function TForm1.QueryWord(const WordString: WideString; lCursorX,
lCursorY: Integer; const SentenceString: WideString; var lLoc,
lStart: Integer): Integer;
begin
mmo1.Text := mmo1.text+SentenceString+#13#10;
end;
end.我写了这一个小程序,做屏幕取词用的,在ie,txt都能生效,不过为什么在一个用VF做的软件就不能截取呢??是不是VF有特别的接口?
begin
Main_Frm.Hide;
Frm_Mainfrm.Show;
BitBtn1.Enabled:=True;
end;procedure TMain_Frm.N1Click(Sender: TObject);
var
StrKye,StrHGpm:string;
begin
if ListView1.Selected<>nil then
begin
//Clipboard.AsText:=ListView1.Selected.Caption;
strkye:=ListView1.Selected.Caption;
StrHGpm:=ListView1.Selected.SubItems[0];
Clipboard.AsText:=ListView1.Selected.Caption+ListView1.Selected.SubItems[0];
SendMessage( ListView1.Selected.Handle,WM_COPY,0,0);
end;
end;procedure TMain_Frm.ListView1MouseDown(Sender: TObject;
Button: TMouseButton; Shift: TShiftState; X, Y: Integer);
var
P: TPoint;
begin
if Button = mbright then
begin
GetCursorPos(p);
PopupMenu1.Popup(p.X, p.Y);
end;
end;procedure TMain_Frm.N2Click(Sender: TObject);
begin
Memo1.CopyToClipboard;
PopupMenu2.CleanupInstance;
//Frm_ZiDianfrm.ShowModal;
Frm_Mainfrm.N2.Click;
//Memo1.PasteFromClipboard;
//Clipboard.AsText:=Frm_ZiDianfrm.Edit1.Text;
end;procedure TMain_Frm.Memo1MouseDown(Sender: TObject; Button: TMouseButton;
Shift: TShiftState; X, Y: Integer);
var
P:TPoint;
begin
if Button=mbright then
begin
GetCursorPos(p);
PopupMenu2.Popup(p.X,p.Y);
end;
end;
......
end.