(*//
标题:获取其他进程中ListBox和ComboBox的内容
说明:Window2000+Delphi6调试通过
设计:Zswang
支持:wjhu111@21cn.com
日期:2004-03-25
//*)
function GetListBoxText(mHandle: THandle; mStrings: TStrings): Boolean;
var
vItemCount: Integer;
I: Integer;
S: string;
begin
Result := False;
if not Assigned(mStrings) then Exit;
mStrings.BeginUpdate;
try
mStrings.Clear;
vItemCount := SendMessage(mHandle, LB_GETCOUNT, 0, 0);
for I := 0 to vItemCount - 1 do begin
SetLength(S, SendMessage(mHandle, LB_GETTEXTLEN, I, 0));
SendMessage(mHandle, LB_GETTEXT, I, Integer(@S[1]));
mStrings.Add(S);
end;
SetLength(S, 0);
finally
mStrings.EndUpdate;
end;
Result := True;
end; { GetListBoxText }
function GetComboBoxText(mHandle: THandle; mStrings: TStrings): Boolean;
var
vItemCount: Integer;
I: Integer;
S: string;
begin
Result := False;
if not Assigned(mStrings) then Exit;
mStrings.BeginUpdate;
try
mStrings.Clear;
vItemCount := SendMessage(mHandle, CB_GETCOUNT, 0, 0);
for I := 0 to vItemCount - 1 do begin
SetLength(S, SendMessage(mHandle, CB_GETLBTEXTLEN, I, 0));
SendMessage(mHandle, CB_GETLBTEXT, I, Integer(@S[1]));
mStrings.Add(S);
end;
SetLength(S, 0);
finally
mStrings.EndUpdate;
end;
Result := True;
end; { GetComboBoxText }
//Example
procedure TForm1.FormCreate(Sender: TObject);
begin
RegisterHotKey(Handle, 1, MOD_WIN, VK_F2);
RegisterHotKey(Handle, 2, MOD_WIN, VK_F3);
end;
procedure TForm1.FormDestroy(Sender: TObject);
begin
UnRegisterHotKey(Handle, 1);
UnRegisterHotKey(Handle, 2);
end;
procedure TForm1.WMHOTKEY(var Msg: TWMHOTKEY);
begin
case Msg.HotKey of
1:
GetListBoxText(
WindowFromPoint(Point(Mouse.CursorPos.X, Mouse.CursorPos.Y)),
MemoText.Lines);
2:
GetComboBoxText(
WindowFromPoint(Point(Mouse.CursorPos.X, Mouse.CursorPos.Y)),
MemoText.Lines);
end;
end;
获取其他进程中ListBox和ComboBox的内容
Delphi中整数与字符串函数应用
最新推荐文章于 2011-01-24 13:23:00 发布
博客可能围绕Delphi展开,涉及integer(整数)、string(字符串)相关内容,重点在于function(函数)在处理整数和字符串方面的应用,属于信息技术领域中软件开发相关内容。
部署运行你感兴趣的模型镜像
您可能感兴趣的与本文相关的镜像
Dify
AI应用
Agent编排
Dify 是一款开源的大语言模型(LLM)应用开发平台,它结合了 后端即服务(Backend as a Service) 和LLMOps 的理念,让开发者能快速、高效地构建和部署生产级的生成式AI应用。 它提供了包含模型兼容支持、Prompt 编排界面、RAG 引擎、Agent 框架、工作流编排等核心技术栈,并且提供了易用的界面和API,让技术和非技术人员都能参与到AI应用的开发过程中
3080

被折叠的 条评论
为什么被折叠?



