(CodeLib-Manager)
Registriert seit: 10. Jun 2002
4.648 Beiträge
Delphi XE Professional
|
Re: Statusbar auslesen
2. Mai 2008, 21:57
Hallo, ich hab's mal so gemacht:
Delphi-Quellcode:
uses
CommCtrl, uProcessMemMgr;
function GetStatusBarText(hStatusBarHandle: HWND; PanelNumber: Integer): string;
var
PMM: TProcessMemMgr;
NumberOfPanels, Len: Integer;
PrcBuf: PChar;
PartText: string;
begin
if hStatusBarHandle = 0 then Exit;
PMM := CreateProcessMemMgrForWnd(hStatusBarHandle);
try
NumberOfPanels := SendMessage(hStatusBarHandle, SB_GETPARTS, 0, 0);
if PanelNumber < NumberOfPanels then
begin
Len := LOWORD(SendMessage(hStatusBarHandle, SB_GETTEXTLENGTH, PanelNumber, 0));
if Len > 0 then
begin
PrcBuf := PMM.AllocMem(Len + 1);
SendMessage(hStatusBarHandle, SB_GETTEXT, PanelNumber, Longint(PrcBuf));
Result := PMM.ReadStr(PrcBuf);
PMM.FreeMem(PrcBuf);
end
else
begin
Result := '';
end;
end;
finally
PMM.Free;
end;
end;
Thomas
|
|
Zitat
|