Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations SkipVought on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

api

Status
Not open for further replies.

mkzw0ot4m0nk

Programmer
Jul 19, 2002
29
0
0
US
hey i wanna know how i can get text from a different window.. i used a api spy program and got the info..

Window Handle: 263106
Window Class Name: TStaticText
Window Style: 1409286401
Window ID Number: 0
Parent Window Handle: 590418
Parent Window Text: MonitorForm
Parent Window Class NAme: TMonitorForm

how do i enter this info into delphi?
 
I don't think I understand your question. Do you want delphi to find the information the spy program found, or do you want it to retrieve text from that window?

You can use FindWindow(ClassName,WindowName) to get the window handle (either value can be nil, but if you make the WindowName nil, you may not get the window you want). Once you have the handle, you can probably get any information windows has, but I don't know how to read text out of another window.
 
As bbegley said you can use FindWindow/FindWindowEx to find a window with a certain name. Or you can use EnumWindows function that enumerates all top level windows on the screen. Those functions will return you a window's handle hWnd using which you can get it's text, styles, extended styles, parent and lots of other stuff. As for window's text: once you have a handle of a window you can do something like this:
Code:
var 
  TxtLength : Integer;
  AText : pChar
begin 
  TxtLength := GetWindowTextLength(hWnd);
  GetWindowText(hWnd, AText, TxtLength);
  ...
end;

--- markus

 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top