打印本文 打印本文 关闭窗口 关闭窗口
將字串传入到Windows目前窗口Cursor所在位置
作者:武汉SEO闵涛  文章来源:敏韬网  点击数753  更新时间:2009/4/23 18:30:57  文章录入:mintao  责任编辑:mintao

网络ID:wnhoo or sos_admin
网名:e梦缘
Mail:
wnhoo@163.com
风花雪月 e梦情缘

如下:

function GetSysFocus : integer;
Var
hOtherWin,OtherThreadID,hFocusWin : integer;
Begin
hOtherWin := GetForegroundWindow;
OtherThreadID := GetWindowThreadProcessID( hOtherWin, nil);
If AttachThreadInput( GetCurrentThreadID, OtherThreadID, true ) Then
Begin
hFocusWin := GetFocus;
result := GetFocus;
AttachThreadInput( GetCurrentThreadID, OtherThreadID, False );
End
else
result := getFocus;
End;


procedure TForm1.Timer1Timer(Sender: TObject);
var
s:string;
begin
s:=''''test'''';
SendMessage(GetSysFocus, WM_SETTEXT,0,longint(PCHAR(S)));
end;

打印本文 打印本文 关闭窗口 关闭窗口