Can anyone give me the synthax of calling user32.dll which allows to retireve the text in a listbox controls
Thanks
USER32.DLL and LISTBOX
-
- Enthusiast
- Posts: 202
- Joined: Sun Apr 27, 2003 4:44 am
- Location: Michigan, USA
- Contact:
-
- Enthusiast
- Posts: 252
- Joined: Fri Feb 20, 2004 5:43 pm
Your main problem might be finding out the handle of the external listbox, but here's some code that should read its text once you have. In my example its reading one I've created, but it should still do the job if you feed in the handle of an external control.
Code: Select all
OpenWindow(0,0,0,400,400,#PB_Window_SystemMenu | #PB_Window_ScreenCentered,"Test")
CreateGadgetList(WindowID())
ListViewGadget(0,10,10,380,380)
AddGadgetItem(0,-1,"This is a line of text")
AddGadgetItem(0,-1,"This is another")
AddGadgetItem(0,-1,"And so on...")
listhandle=GadgetID(0) ;This needs to be the handle of your external listbox
listcount=SendMessage_(listhandle,#LB_GETCOUNT,0,0)
For temp=0 To listcount-1
length=SendMessage_(listhandle,#LB_GETTEXTLEN,temp,0)
tempstring$=Space(length)
SendMessage_(listhandle,#LB_GETTEXT,temp,@tempstring$)
string$=string$+" "+tempstring$
Next
Debug string$
Repeat
Until WaitWindowEvent()=#PB_Event_CloseWindow