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

  • Home
  • SEARCH
  • 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 4096596
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 20, 20262026-05-20T20:04:00+00:00 2026-05-20T20:04:00+00:00

I’m trying to access window’s elements of a program, of which I have only

  • 0

I’m trying to access window’s elements of a program, of which I have only the binaries and installed stuff.

For example, I want to click on a certain item of a certain listbox in an automated way.

I’m only interested in accessing one listbox of one window of the program, but this would help me create a very good macro (the list box is full of “expands”, it’s long, and dynamic).

I thought about using macros like Autohotkey, but quickly considered it a bad idea.

I don’t even know how to call this, but i tried searching for “hook” related stuff, without success.

PS: I’m on a 64 bits Windows 7 system, using Code Blocks. Let me know if there is a better IDE for that, like VS, because i can use it too.

EDIT

Ok, so I caught the information of the window using WinSpy++, though I don’t really know what to do with it. I’m trying to get the handle of the child window, but am failing.
I’m very noob at this. I reminded of an important detail, I need to get the names of the listbox elements and their positions (1st, 2nd, 3rd), is it possible?

EDIT 2 (Where I am)
Ok, here is where I am so far: I caught the main window handle, but can’t get the handle of any of the children. My googling turned up a “GetDlgItem” function, but didn’t work. Any ideas?

  • 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-05-20T20:04:00+00:00Added an answer on May 20, 2026 at 8:04 pm

    You may be able to use Spy++ to find the specific class and/or caption for the window (the listbox control) and then target it via FindWindow().

    If not, you’ll have to find the app’s main window, and traverse its children, looking for the children of the children until you find the listbox window.

    Once you finally have the window handle, you can just PostMessage() the WM_CLICK message to it.

    EDIT 1 (For Meysam)

    I started by googling for Listview window messages. That took me to this MSDN page. Looking down through the list, LVM_GETITEM stands out. It takes an LVITEM structure as an LPARAM.

    In that struct, the iItem member identifies the index. All that you need to know now is an item count, so that you can iterate through each index, and write code like this pseudocode:

    for (int i = 0; i < item_count; i++)
    {
        LVITEM lvi;
        lvi.iItem = i; // probably need to set other pieces of the struct
        LRESULT item = SendMessage(hwnd, LVM_GETITEM, NULL, (LPARAM)lvi);
    }
    

    For how many items (item_count), use LVM_GETITEMCOUNT.

     LRESULT item_count = SendMessage(hwnd, LVM_GETITEMCOUNT, NULL, NULL);
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

No related questions found

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.