Source watts on the 15.07.2007 from the MMJ-Quellcodesammlung (Dietmar horn) in The Babyklappe on XProfan.Com stored:
Listbox: Strings in Listboxes search
Program-Listbox8
example zweier Listboxes (Single- and Multiselect). example How Strings in whom
boxing sought go can. In the treatment exists one Difference!
The AUSWERTUNG markierter Lines becomes here not treats.
Version 1.0 12.09.2003. the Program can spare using go, for
Schäden can no Liability übernommen be.
Author: Gerhard Putschalka
homepage: http://members.telering.at/g.putschalka/index.html
email: g.putschalka@web.de
Declare Dlg%,X%,Single%,Multi%,SingleBox&,MultiBox&,TxtBer#,end%,Edit%,Ergeb&,Zw$
Dim TxtBer#,255 max. Text Length of/ one Listboxzeile (ought to here sufficient big his)
SetTrueColor 1
Cls @RGB(255,255,255)
Let Dlg%=@CreateDialog(%Hwnd,Search in SingleSelect and in MultiSelect Listbox,250,40,465,360)
@createtext(Dlg%,give tappt im dunkeln a Suchbegriff one and pressing tappt im dunkeln whom Button,30,5,424,16)
@createtext(Dlg%,>search< the jeweiligen Listbox.,30,25,250,16)
@createtext(Dlg%,Suchbegriff:,30,280,80,16)
Listbox with einzeiliger Auswahlmöglichkeit
Let SingleBox& = control(LISTBOX,,$50B000C1,20,50,200,200,Dlg%,101,%HINSTANCE)
becomes here $50B000C3 indicated, becomes the Listboxinhalt sortiert.
Listbox with mehrzeiliger Auswahlmöglichkeit
Let MultiBox& = control(LISTBOX,,$50B008C1,240,50,200,200,Dlg%,101,%HINSTANCE)
becomes here $50B008C3 indicated, becomes the Listboxinhalt sortiert.
Let Single% = @CreateButton(Dlg%,search,70,250,80,20)
Let end% = @CreateButton(Dlg%,terminate,190,250,80,20)
Let Multi% = @CreateButton(Dlg%,search,300,250,80,20)
Let Edit% = @CreateEdit(Dlg%,,120,280,200,20)
Texts in The Listbox to put
@AddStrings(SingleBox&,example)
@AddStrings(SingleBox&,of/ one)
@AddStrings(SingleBox&,Listbox)
@AddStrings(SingleBox&,with the)
@AddStrings(SingleBox&,Possibility the)
@AddStrings(SingleBox&,Einfachauswahl)
@AddStrings(SingleBox&,of)
@AddStrings(SingleBox&,Lines)
Texts in The Listbox to put
@AddStrings(MultiBox&,example)
@AddStrings(MultiBox&,of/ one)
@AddStrings(MultiBox&,Listbox)
@AddStrings(MultiBox&,with the)
@AddStrings(MultiBox&,Possibility the)
@AddStrings(MultiBox&,Multiple choice)
@AddStrings(MultiBox&,of)
@AddStrings(MultiBox&,Lines)
1. Loop To terminate Button pressed watts
whilenot @GetFocus(end%)
WaitKey
evaluate for Mehrzeilen-Box
If getfocus(Multi%)
@createtext(Dlg%, ,30,310,450,16)
to that Search gives it here only a Possibility
here must (ought to) a Memory-Variable using be.
String TxtBer#,0 = @GetText$(Edit%)
Ergeb& = @Sendmessage(MultiBox&,$018F,-1,TxtBer#) API: LB_FINDSTRING
the Mark the Eintrags (if pseudo) must the extra erfolgen
If (Ergeb& < 0) not found
@Sendmessage(MultiBox&,$0185,0,Ergeb&) lösche The Mark (API: LB_SETSEL)
@createtext(Dlg%,The Suchbegriff is in the Multi-Listbox not present,30,310,450,16)
Else
@Sendmessage(MultiBox&,$0185,1,Ergeb&) set Mark (API: LB_SETSEL)
Let Zw$ = The Suchbegriff is in the Multi-Listbox. entry =,@Str $(Ergeb&)
@createtext(Dlg%,Zw$,30,310,450,16)
EndIf
evaluate for Einzelzeilen-Box
ElseIf getfocus(Single%)
@createtext(Dlg%, ,30,310,450,16)
-------- only 1 group of it select:
to that Search gives it here three Opportunities:
1. The Profanbefehl @Select String. seek and markiert
Let Ergeb& = @Select String(SingleBox&,-1,@GetText$(Edit%))
2. or The API function LB_SELECTSTRING (with Sendmessage and $018C) corresponds to the
Profanfunktion. here must (ought to) a Memory-Variable using be.
String TxtBer#,0 = @GetText$(Edit%)
Let Ergeb& = @SendMessage(SingleBox&,$018C,-1,TxtBer#)
3. or The API function LB_FINDSTRING (with Sendmessage and $018F)
here must (ought to) a Memory-Variable using be. The found concept
becomes here NOT markiert! Ergeb& supply but The Zeilennummer.
String TxtBer#,0 = @GetText$(Edit%)
Let Ergeb& = @SendMessage(SingleBox&,$018F,-1,TxtBer#)
--------
If (Ergeb& < 0) not found
@Sendmessage(SingleBox&,$0186,-1,0) delete the Mark
@createtext(Dlg%,The Suchbegriff is in the Single-Listbox not present,30,310,450,16)
Else
Let Zw$ = The Suchbegriff is in the Single-Listbox. entry =,@Str $(Ergeb&)
@createtext(Dlg%,Zw$,30,310,450,16)
EndIf
Endif
EndWhile
Dispose TxtBer#
End