首页 > 代码库 > 获取其他进程中StatusBar的文本
获取其他进程中StatusBar的文本
(*//标题:获取其他进程中StatusBar的文本说明:Window2000+Delphi6调试通过设计:Zswang支持:wjhu111@21cn.com日期:2005-02-22//*)
uses CommCtrl;
function GetStatusBarText(mHandle: THandle): string;var vBuffer: array[0..$1000] of Char; vSize: Integer; I: Integer; vCount: Integer; vProcessId: DWORD; vProcess: THandle; vPointer: Pointer; vNumberOfBytesRead: Cardinal;begin Result := ‘‘; vCount := SendMessage(mHandle, SB_GETPARTS, 0, 0); if vCount <= 0 then Exit; GetWindowThreadProcessId(mHandle, @vProcessId); vProcess := OpenProcess(PROCESS_VM_OPERATION or PROCESS_VM_READ or PROCESS_VM_WRITE, False, vProcessId); vPointer := VirtualAllocEx(vProcess, nil, $1000, MEM_RESERVE or MEM_COMMIT, PAGE_READWRITE); try for I := 0 to vCount - 1 do begin vSize := SendMessage(mHandle, SB_GETTEXT, I, 0) + 1; SendMessage(mHandle, SB_GETTEXT, I, Integer(vPointer)); ReadProcessMemory(vProcess, vPointer, @vBuffer[0], vSize, vNumberOfBytesRead); Result := Result + #9 + vBuffer; end; Delete(Result, 1, 1); finally VirtualFreeEx(vProcess, vPointer, 0, MEM_RELEASE); CloseHandle(vProcess); end;end; { GetStatusBarText }
//Exampleprocedure TForm1.FormCreate(Sender: TObject);begin RegisterHotKey(Handle, 1, MOD_WIN, VK_F2);end;
procedure TForm1.FormDestroy(Sender: TObject);begin UnRegisterHotKey(Handle, 1);end;
procedure TForm1.WMHOTKEY(var Msg: TWMHOTKEY);begin case Msg.HotKey of 1: Edit1.Text := GetStatusBarText( WindowFromPoint(Point(Mouse.CursorPos.X, Mouse.CursorPos.Y))); end;end;
http://blog.csdn.net/zswang/article/details/297038
获取其他进程中StatusBar的文本
声明:以上内容来自用户投稿及互联网公开渠道收集整理发布,本网站不拥有所有权,未作人工编辑处理,也不承担相关法律责任,若内容有误或涉及侵权可进行投诉: 投诉/举报 工作人员会在5个工作日内联系你,一经查实,本站将立刻删除涉嫌侵权内容。