当前位置:主页>Delphi教程>文章内容
將字串传入到Windows目前窗口Cursor所在位置
来源: 作者: 发布时间:2007-04-29  

网络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;


 
上一篇:用Delphi对SQL-DMO进行封装的一种实现   下一篇:Format的用法
 
  相关文章
·用Delphi对SQL-DMO进行封装的一种实现
·Format的用法
·防止程序多次运行
·数字随机排序
·Delphi与C++之间通过实现函数与对象共
·关于流的使用资料及相关实例
·编译资源进入可执行程序
·使用TImage浏览与保存网络图像
·拖拉打开文件
·Delphi控制Excel的重要属性和方法
·注册文件类型,设置文件图标
·Delphi的接口陷阱
 
【关闭窗口】
推荐本站资源
最新文章