Delphi Pages Forums  

Go Back   Delphi Pages Forums > Delphi Forum > General

Lost Password?

Reply
 
Thread Tools Display Modes
  #1  
Old 11-19-2001, 06:32 AM
-=sphinx=- -=sphinx=- is offline
Junior Member
 
Join Date: Nov 2001
Posts: 2
Default Text from a particular window

how do i get text from a PARTICULAR/SPECIFIC window, ie get text from an icq chat window or something, i seen code here that gets the txt from a window that a mouse is over, but unfortunately this is of no use to me! :-(

Please can someone help?

-= thanx for all comments =-
Reply With Quote
  #2  
Old 11-19-2001, 06:51 AM
B at work B at work is offline
Senior Member
 
Join Date: Oct 2001
Posts: 421
Default RE: Text from a particular window

hello,

if you know the name of the component in the window, this may work, when the windows accepts messages:

procedure TForm1.Button1Click(Sender: TObject);
var
Buffer : Array [0..255] of char;
MyHandle : hwnd;
begin
MyHandle := FindWindowEx( FindWindow('Windows Name', nil),
0, 'Components name', nil);

SendMessage(MyHandle, WM_GETTEXT, SizeOf(Buffer), LongInt(@Buffer));
Label1.Caption := Buffer;
end;

cu, B
Reply With Quote
  #3  
Old 11-19-2001, 09:19 AM
TiTeaM TiTeaM is offline
Senior Member
 
Join Date: Jan 2001
Posts: 113
Default RE: Text from a particular window

you may use the windows api function WindowFromPoint in order to know the handle of the window the mouse is over.

eg :


function GetWindowText(Wnd: hWnd; var Text: string): Boolean;
var
L: Integer;
begin
L:=SendMessage(Wnd,WM_GETTEXTLENGTH,0,0);
Result:=L<>0;
if Result then
begin
SetLength(Text,L);
SendMessage(Wnd,WM_GETTEXT,L+1,LongInt(Text));
Result:=True;
end;
end;


var
Text: string;
begin
if GetWindowText(WindowFromPoint(Mouse.CursorPos),Tex t) then
Form1.Caption:=Text;
end;
Reply With Quote
Reply

Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is On

Forum Jump


All times are GMT. The time now is 07:38 PM.


Powered by vBulletin® Version 3.8.8
Copyright ©2000 - 2019, vBulletin Solutions, Inc.