Go Back  Xtreme Visual Basic Talk > Legacy Visual Basic (VB 4/5/6) > General > listbox of external app


Reply
 
Thread Tools Display Modes
  #1  
Old 04-21-2003, 05:31 AM
adamandhelen adamandhelen is offline
Centurion
 
Join Date: Feb 2003
Posts: 154
Default listbox of external app


i am shelling a 3rd party app (ifoedit) from within vb and have got the handles to all buttons,listboxes etc. what i need to do is either copy the listbox text to a text file for searching or search the listbox direct (preferred). i would need to search for the phrase (Menu Language Units and then read the number shown directly after it - on the same line- (1,2 or 3 etc) if the search resulted in say,2, then i would need to continue the search from this point in the listbox for the following phrase (Language Menu Unit 1, then read the following text in the brackets eg [English] and return this as string1. continue to next line for (Language Menu Unit 2, read the text [Francais] and return this as string2.

complicated eh.

is this poss?

i have tried various send/postmessages for LB_GETTEXT but nothing seems to work. is there another way'

LB_GETTEXT is defined by const LB_GETTEXT = &H189 (got this from apilist)

thanks for your advice
Reply With Quote
  #2  
Old 04-21-2003, 10:20 AM
adamandhelen adamandhelen is offline
Centurion
 
Join Date: Feb 2003
Posts: 154
Default

any ideas?
Reply With Quote
  #3  
Old 04-21-2003, 10:33 AM
reboot's Avatar
reboot reboot is offline
Keeper of foo

Retired Moderator
* Guru *
 
Join Date: Nov 2001
Location: Graceland
Posts: 15,612
Default

Basically, once you have the Listbox hWnd, you use LB_GETCOUNT to get the number of lines in the listbox. Then you need the size of all of them, so in a For loop (For count = 0 to Number of Lines - 1) you add together the length of each line using LB_GETTEXTLEN. Allocate this much to a String var, then in another For loop you go through the Listbox line by line using LB_GETTEXT. In your SendMessage in this loop, your wParam should be the line number in the Listbox you're on (your for loop counter) and your lParam will be the position in the string variable where this line goes. Probably you want a vbCrLf between each one also. Just add it after every line you read.

This reads all lines in the listbox. If you just want a particular line, you don't need the For loops. You still have to find the length of the line you want, allocate memory for it, and pass that line number via SendMessage.
Reply With Quote
  #4  
Old 04-21-2003, 12:32 PM
adamandhelen adamandhelen is offline
Centurion
 
Join Date: Feb 2003
Posts: 154
Default

thanks for that. however, i have since discovered it is not a listbox but a listview. with the correct const i can now get the getcount. what is the equivalent listview command for LB_GETTEXTLEN and LB_GETTEXT.
http://www.mvps.org/vbnet/
the above has been quite helpful for the const but i can't find a similar expression to what is required?
thanks
Reply With Quote
Reply


Currently Active Users Viewing This Thread: 1 (0 members and 1 guests)
 
Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off

Forum Jump

Similar Threads
Thread Thread Starter Forum Replies Last Post
Ownerdrawing ListBox Squirm Miscellaneous Languages 2 03-01-2003 06:47 PM
Another Listbox question. CurtE General 1 02-26-2003 12:16 AM
Listbox and "shell"ing an app. meteo General 4 12-19-2002 11:26 AM
Help on ListBox.AddItem bondie Word, PowerPoint, Outlook, and Other Office Products 18 11-12-2002 01:50 PM
Have Listbox Rowsource reference external recordset Rezner Word, PowerPoint, Outlook, and Other Office Products 6 05-19-2002 05:23 PM

Advertisement:





Free Publications
The ASP.NET 2.0 Anthology
101 Essential Tips, Tricks & Hacks - Free 156 Page Preview. Learn the most practical features and best approaches for ASP.NET.
subscribe
Programmers Heaven C# School Book -Free 338 Page eBook
The Programmers Heaven C# School book covers the .NET framework and the C# language.
subscribe
Build Your Own ASP.NET 3.5 Web Site Using C# & VB, 3rd Edition - Free 219 Page Preview!
This comprehensive step-by-step guide will help get your database-driven ASP.NET web site up and running in no time..
subscribe
 
 
-->