Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

how can access and read the caption of Label in other program

Tags:

delphi

there is a program that i guess it made with Visual Basic class. and i dont have source code and i dont change it. it has a MainForm and there is a Frame into MainFrom and there is a Label into Frame . the name of Label is Label1 . this program show some data with Label1 . i want to read the caption of Label1 with my program . my program is in delphi . i can access to handle of mainform and frame with their title or their class , as fallow:

Hnd := FindWindow('ThunderRT6FormDC', nil); // find handle of mainForm

Hnd2 := FindWindowEx(Hnd, 0, 'ThunderRT6Frame', nil); // find handle of Frame in mainform

but i dont know how can access or read the caption of Label1 . please help me ...

like image 863
Seyed Mousa Avatar asked Oct 29 '25 15:10

Seyed Mousa


1 Answers

Here are the things that you can try:

  1. Use Spy++, WinSpy or similar to see if the control is windowed. If so you should be able to extract the text with WM_GETTEXT.
  2. Otherwise, use InspectUI to see if the program is automatable. If so use UIAutomation.
  3. Otherwise, inject some VB code into the program and hack the label text out. That's going to require reverse engineering this other program and a deep knowledge of VB and the GUI framework that the program uses.
  4. As a final option, take a screenshot and use OCR to read the label.

Frankly, if the first two options prove to be not available I would think OCR is actually the easiest.

like image 146
David Heffernan Avatar answered Oct 31 '25 06:10

David Heffernan



Donate For Us

If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!