Reading Listbox values of other window

Please support our C++ advertiser: Intel Parallel Studio Home
Reply

Join Date: Oct 2009
Posts: 5
Reputation: codecodile is an unknown quantity at this point 
Solved Threads: 0
codecodile codecodile is offline Offline
Newbie Poster

Reading Listbox values of other window

 
3
  #1
Oct 2nd, 2009
Hi,

Can anyone help me finding an application which can read listbox values of any other window on screen and save the list items either to clipboard or some text file, etc.

This may be done by getting the handle of the window/listbox and then reading the values, etc. I am novice in C programming.

Any help would be greatly appreciated.

Thanks.
Reply With Quote Quick reply to this message  
Join Date: Mar 2008
Posts: 1,405
Reputation: William Hemsworth has much to be proud of William Hemsworth has much to be proud of William Hemsworth has much to be proud of William Hemsworth has much to be proud of William Hemsworth has much to be proud of William Hemsworth has much to be proud of William Hemsworth has much to be proud of William Hemsworth has much to be proud of William Hemsworth has much to be proud of 
Solved Threads: 114
Sponsor
William Hemsworth William Hemsworth is offline Offline
Nearly a Posting Virtuoso

Re: Reading Listbox values of other window

 
1
  #2
Oct 2nd, 2009
Assuming this is the defaut Windows API listbox..

Step 1: Find a handle to the window containing the list box. [link]
Step 2: Allocate enough space to hold the strings. eg.
  1. int count = (int) SendMessage( listbox, LB_GETCOUNT, 0, 0 );
  2. std::string *items = new string[count];
Step 3: Retrieve those values. eg.
  1. for (int i = 0; i < count; ++i) {
  2. int itemLength = SendMessage( listbox, LB_GETTEXTLEN, i, 0 );
  3. char *temp = new char[itemLength];
  4.  
  5. SendMessage( listbox, LB_GETTEXT, i, (LPARAM)&temp );
  6. items[i] = temp;
  7.  
  8. delete[] temp;
  9. }
I haven't tested this code, but it should work if you apply it right. Hope this helps.
I need pageviews! most fun profile ever :)
Reply With Quote Quick reply to this message  
Join Date: Oct 2009
Posts: 5
Reputation: codecodile is an unknown quantity at this point 
Solved Threads: 0
codecodile codecodile is offline Offline
Newbie Poster

Re: Reading Listbox values of other window

 
1
  #3
Oct 3rd, 2009
thanks William, for your response.
Can you pls do me a favor to write a tiny app to read those values. With an interface like, specifying the window handle by some drag/drop thing and then read the list box values, etc.

I am very new to C++ programming and got this as a task :-s

Look forward to your response...
Reply With Quote Quick reply to this message  
Join Date: Mar 2008
Posts: 1,405
Reputation: William Hemsworth has much to be proud of William Hemsworth has much to be proud of William Hemsworth has much to be proud of William Hemsworth has much to be proud of William Hemsworth has much to be proud of William Hemsworth has much to be proud of William Hemsworth has much to be proud of William Hemsworth has much to be proud of William Hemsworth has much to be proud of 
Solved Threads: 114
Sponsor
William Hemsworth William Hemsworth is offline Offline
Nearly a Posting Virtuoso

Re: Reading Listbox values of other window

 
2
  #4
Oct 3rd, 2009
Originally Posted by codecodile View Post
thanks William, for your response.
Can you pls do me a favor to write a tiny app to read those values. With an interface like, specifying the window handle by some drag/drop thing and then read the list box values, etc.

I am very new to C++ programming and got this as a task :-s

Look forward to your response...
That's too much to ask for.

If you're very new to programming, you shouldn't have been set a task like this. I wont do it for you, but what I will do is lead you in the right direction. Start by familiarizing yourself with basic C++, then follow this Win32 API tutorial [link]
There's plenty in there to get you started, after all, that's exactly how I learnt it.

Remember, we aren't here to write code for you.
I need pageviews! most fun profile ever :)
Reply With Quote Quick reply to this message  
Join Date: Apr 2008
Posts: 118
Reputation: marco93 is infamous around these parts marco93 is infamous around these parts marco93 is infamous around these parts 
Solved Threads: 12
marco93 marco93 is offline Offline
Junior Poster

Re: Reading Listbox values of other window

 
0
  #5
Oct 3rd, 2009
Originally Posted by William Hemsworth View Post
I haven't tested this code,.
It won't fork for od listbox
.................................
Last edited by marco93; Oct 3rd, 2009 at 7:03 am.
Reply With Quote Quick reply to this message  
Join Date: Mar 2008
Posts: 1,405
Reputation: William Hemsworth has much to be proud of William Hemsworth has much to be proud of William Hemsworth has much to be proud of William Hemsworth has much to be proud of William Hemsworth has much to be proud of William Hemsworth has much to be proud of William Hemsworth has much to be proud of William Hemsworth has much to be proud of William Hemsworth has much to be proud of 
Solved Threads: 114
Sponsor
William Hemsworth William Hemsworth is offline Offline
Nearly a Posting Virtuoso

Re: Reading Listbox values of other window

 
0
  #6
Oct 3rd, 2009
What? Once again, not helping.
Also, I said
Assuming this is the defaut Windows API listbox.
Last edited by William Hemsworth; Oct 3rd, 2009 at 8:38 am.
I need pageviews! most fun profile ever :)
Reply With Quote Quick reply to this message  
Join Date: Oct 2009
Posts: 5
Reputation: codecodile is an unknown quantity at this point 
Solved Threads: 0
codecodile codecodile is offline Offline
Newbie Poster

Re: Reading Listbox values of other window

 
1
  #7
Oct 3rd, 2009
Well, thanks Williams for guiding me to the tutorial.

Actually I am C# developer and may be I can convert your provided code .net to have it work for me.
Reply With Quote Quick reply to this message  
Reply

Message:


Thread Tools Search this Thread



About Us | Contact Us | Advertise | DaniWeb | Acceptable Use Policy | RSS Feed

©2003 - 2009 DaniWeb® LLC