[DUG] Pulling status bar text off another application
Jeremy Coulter
vss at vss.co.nz
Mon Jul 30 15:17:31 NZST 2007
Hi Phil. try this. I use this to get info from another application and use
this code.
Jeremy
function
GetStatusBarText: string;
var
PMM: TProcessMemMgr;
NumberOfPanels, Len: Integer;
PrcBuf: PChar;
hWindow,
hStatusBarHandle: HWND;
PanelNumber : integer;
begin
PanelNumber:=2;
hWindow := FindWindow('TfmMain',
nil);
if hWindow = 0 then Exit;
hStatusBarHandle :=
FindWindowEx(hWindow, 0, 'TStatusbar', nil);
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;
-----Original Message-----
From: "Phil Scadden" <p.scadden at gns.cri.nz>
To: delphi at delphi.org.nz
Date: Mon, 30 Jul 2007 14:57:32 +1200
Subject: [DUG] Pulling status bar text off another application
A webapp running in IE put text in the status bar that I would dearly
like
to snaffle into another running application. Statusbar I think is a
wincontrol
so could be possible. Anyone with bright ideas on discovering it?
----------------------------------------------------------
Phil Scadden, GNS Science Ltd
764 Cumberland St, Private Bag 1930, Dunedin, New Zealand
Ph +64 3 4799663, fax +64 3 477 5232
_______________________________________________
NZ Borland Developers Group - Delphi mailing list
Post: delphi at delphi.org.nz
Admin: http://delphi.org.nz/mailman/listinfo/delphi
[http://delphi.org.nz/mailman/listinfo/delphi]
Unsubscribe: send an email to delphi-request at delphi.org.nz with Subject:
unsubscribe
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://www.adventureeducation.co.nz/pipermail/delphi/attachments/20070730/17208707/attachment.html
More information about the Delphi
mailing list