'Source wurde am 15.07.2007 aus der MMJ-Quellcodesammlung (Dietmar Horn) in die Babyklappe auf XProfan.Com abgelegt:
'Listview erstellen
$I profalt.inc
DEF @GetSysColor(1) !"USER32","GetSysColor"
Settruecolor 1
Declare CLASSNAME$,LVHandle&,OK&,LVC#,TXT$,Text#,Text&,LVI#,Chosen&
Declare Columntext#,Line#,LVITEM#,List_Text#,Line1$,Line2$,Line3$,Style&
Windowstyle 31
Windowtitle "A little ListView"
Window 0,0-640,440
CLS @getsyscolor(15)
LET OK&=@CREATEBUTTON(%HWND,"OK",10,360,100,30)
LET CLASSNAME$="SysListView32"
Let Style&=$40000000+$10000000+$0001+$0200+$8
LET LVHandle&=@Control(CLASSNAME$,"",Style&,20,20,300,300,%HWND,0,%Hinstance)
@sendmessage(LVHandle&,$1036,0,$20+$1)'show lines, select full row
@sendmessage(LVHandle&,$1036,0,$20+$1+$4)'show checkboxes,show lines, select full row
Dim LVC#,24
DIM Columntext#,256
String Columntext#,0="Column 1"
Long LVC#,12=Columntext#
Long LVC#,0=$0001+$0002+$0004+$0008
Long LVC#,4=0
Long LVC#,8=100
Long LVC#,20=0
Long LVC#,16=@LEN(@String$(Columntext#,0))+1
@sendmessage(LVHandle&,@ADD($1000,27),1,LVC#)
String Columntext#,0="Column 2"
Long LVC#,12=Columntext#
Long LVC#,0=$0001+$0002+$0004+$0008
Long LVC#,4=0
Long LVC#,8=100
Long LVC#,20=0
Long LVC#,16=@LEN(@String$(Columntext#,0))+1
@sendmessage(LVHandle&,@ADD($1000,27),2,LVC#)
String Columntext#,0="Column 3"
Long LVC#,12=Columntext#
Long LVC#,0=$0001+$0002+$0004+$0008
Long LVC#,4=0
Long LVC#,8=100
Long LVC#,20=0
Long LVC#,16=@LEN(@String$(Columntext#,0))+1
@sendmessage(LVHandle&,@ADD($1000,27),3,LVC#)
Dispose Columntext#
Proc Get_List_Text
Parameters LV_HANDLE&,List_Index&,ColumnIndex&
Declare ERG$
Dim Line#,36
DIM List_Text#,256
CLEAR Line#
long Line#,0=$1
long Line#,8=ColumnIndex&
long Line#,4=List_Index&
long Line#,20=List_Text#
long Line#,24=256
@sendmessage(LV_HANDLE&,$1005,List_Index&,Line#)
Let ERG$=@String$(List_Text#,0)
Dispose Line#
Dispose List_Text#
Return ERG$
Endproc
DIM LVI#,36
Dim Columntext#,256
Clear LVI#
String Columntext#,0="Line 1 / Column 1"
Long LVI#,0=$0001
Long LVI#,4=0
Long LVI#,8=0
Long LVI#,20=Columntext#
Long LVI#,24=@LEN(@string$(Columntext#,0))
@sendmessage(LVHandle&,$1000+7,1,LVI#)
String Columntext#,0="Line 2 / Column 2"
Long LVI#,0=$0001
Long LVI#,4=1
Long LVI#,8=0
Long LVI#,20=Columntext#
Long LVI#,24=@LEN(@string$(Columntext#,0))
@sendmessage(LVHandle&,$1000+7,1,LVI#)
String Columntext#,0="Line 3 / Column 1"
Long LVI#,0=$0001
Long LVI#,4=2
Long LVI#,8=0
Long LVI#,20=Columntext#
Long LVI#,24=@LEN(@string$(Columntext#,0))
@sendmessage(LVHandle&,$1000+7,2,LVI#)
String Columntext#,0="Line 1 / Column 3"
Long LVI#,0=$0001
Long LVI#,4=0
Long LVI#,8=2
Long LVI#,20=Columntext#
Long LVI#,24=@LEN(@string$(Columntext#,0))
@sendmessage(LVHandle&,$1000+46,0,LVI#)
String Columntext#,0="Line 3 / Column 2"
Long LVI#,0=$0001
Long LVI#,4=2
Long LVI#,8=1
Long LVI#,20=Columntext#
Long LVI#,24=@LEN(@string$(Columntext#,0))
@sendmessage(LVHandle&,$1000+46,2,LVI#)
Dispose Columntext#
Dispose LVC#
Dispose LVI#
While 0=0
IF @getfocus(OK&)
LET Chosen&=@sendmessage(LVHandle&,$100C,-1,2)
LET Chosen&=Chosen&+1
IF Chosen&<>0
Get_List_Text LVHandle&,Chosen&-1,0
LEt Line1$=@$(0)
Get_List_Text LVHandle&,Chosen&-1,1
LEt Line2$=@$(0)
Get_List_Text LVHandle&,Chosen&-1,2
LEt Line3$=@$(0)
@messagebox("Text in column 1: "+Line1$+"Text in column 2: "+Line2$+"Text in column 3: "+Line3$,"Line "+@str$(Chosen&)+" has been chosen!",64)
endif
endif
wend
'--------------------------------------------------------------------------------
'regards