Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 8421285
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 10, 20262026-06-10T03:06:36+00:00 2026-06-10T03:06:36+00:00

How can i read a listbox items in another application’s window? I could get

  • 0

How can i read a listbox items in another application’s window? I could get the window’s handle but i dont know a clear way to access components within.

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-06-10T03:06:38+00:00Added an answer on June 10, 2026 at 3:06 am

    You can try to get something from the following project, where is shown, how to enumerate child windows, filter them for a given class name and how to get the items of a list box. I would comment it, but this would be a long story, so please take it as a temporary post…

    Unit1.pas

    unit Unit1;
    
    interface
    
    uses
      Windows, Messages, SysUtils, Variants, Classes, Graphics, Controls, Forms,
      Dialogs, StdCtrls;
    
    type
      TEnumData = class
        ClassName: string;
        HandleItems: TStrings;
      end;
    
    type
      TForm1 = class(TForm)
        CloneListBox: TListBox;
        HandleEdit: TEdit;
        HandleListBox: TListBox;
        HandleEnumButton: TButton;
        procedure HandleEnumButtonClick(Sender: TObject);
        procedure HandleListBoxClick(Sender: TObject);
      private
        { Private declarations }
      public
        { Public declarations }
      end;
    
    var
      Form1: TForm1;
    
    implementation
    
    {$R *.dfm}
    
    function EnumCallback(Handle: HWND; EnumData: TEnumData): BOOL; stdcall;
    var
      Buffer: array[0..255] of Char;
    begin
      Result := True;
      if GetClassName(Handle, Buffer, 256) <> 0 then
        if Buffer = EnumData.ClassName then
          EnumData.HandleItems.Add(IntToStr(Handle));
    end;
    
    procedure GetListBoxItems(Handle: HWND; Target: TListBox);
    var
      I: Integer;
      ItemCount: Integer;
      TextBuffer: string;
      TextLength: Integer;
    begin
      ItemCount := SendMessage(Handle, LB_GETCOUNT, 0, 0);
      if ItemCount <> LB_ERR then
      begin
        Target.Items.BeginUpdate;
        try
          Target.Clear;
          for I := 0 to ItemCount - 1 do
          begin
            TextLength := SendMessage(Handle, LB_GETTEXTLEN, I, 0);
            SetLength(TextBuffer, TextLength);
            SendMessage(Handle, LB_GETTEXT, I, LPARAM(PChar(TextBuffer)));
            Target.Items.Add(TextBuffer);
          end;
        finally
          Target.Items.EndUpdate;
        end;
      end;
    end;
    
    procedure TForm1.HandleEnumButtonClick(Sender: TObject);
    var
      EnumData: TEnumData;
    begin
      EnumData := TEnumData.Create;
      try
        EnumData.ClassName := 'TListBox';
        EnumData.HandleItems := HandleListBox.Items;
        EnumChildWindows(StrToInt(HandleEdit.Text), @EnumCallback, LPARAM(EnumData));
      finally
        EnumData.Free;
      end;
    end;
    
    procedure TForm1.HandleListBoxClick(Sender: TObject);
    var
      SourceHandle: Integer;
    begin
      if TryStrToInt(HandleListBox.Items[HandleListBox.ItemIndex], SourceHandle) then
        GetListBoxItems(SourceHandle, CloneListBox);
    end;
    
    end.
    

    Unit1.dfm

    object Form1: TForm1
      Left = 0
      Top = 0
      Caption = 'Form1'
      ClientHeight = 259
      ClientWidth = 460
      Color = clBtnFace
      Font.Charset = DEFAULT_CHARSET
      Font.Color = clWindowText
      Font.Height = -11
      Font.Name = 'Tahoma'
      Font.Style = []
      OldCreateOrder = False
      PixelsPerInch = 96
      TextHeight = 13
      object CloneListBox: TListBox
        Left = 224
        Top = 8
        Width = 228
        Height = 243
        ItemHeight = 13
        TabOrder = 0
      end
      object HandleEnumButton: TButton
        Left = 127
        Top = 8
        Width = 88
        Height = 25
        Caption = 'Enumerate'
        TabOrder = 1
        OnClick = HandleEnumButtonClick
      end
      object HandleListBox: TListBox
        Left = 8
        Top = 40
        Width = 207
        Height = 211
        ItemHeight = 13
        TabOrder = 2
        OnClick = HandleListBoxClick
      end
      object HandleEdit: TEdit
        Left = 8
        Top = 8
        Width = 113
        Height = 21
        TabOrder = 3
        Text = '0'
      end
    end
    

    Project1.dpr

    program Project1;
    
    uses
      Forms,
      Unit1 in 'Unit1.pas' {Form1};
    
    {$R *.res}
    
    begin
      Application.Initialize;
      Application.MainFormOnTaskbar := True;
      Application.CreateForm(TForm1, Form1);
      Application.Run;
    end.
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I can read unmanaged memory in C# using UnmanagedMemoryStream, but how can I do
I have a ListBox that gets populated with items read from a JSON response.
i have read many posts but can not find my answer.my question is a
You can read this question where I ask about the best architecture for a
I can read settings like this, for example: final String mytest = System.getString(this.getContentResolver(), System.AIRPLANE_MODE_ON);
I can read XLS file with this code : string path =@c:\r\1.xlsx; OleDbConnection MyConnection
How I can Read the RGB-Pixel by Pixel values from CGImagea also after how
In main I can read my config file, and supply it as runReader (somefunc)
how to make php can read log file in /var/log/.... I tried this code
In C++ I Can Read The MAC Address Of The NIC and Use It

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.