hi all ASM coders,

i have a problem in listbox.how to put a column header in listbox?
where is the problem in this code?


invoke CreateWindowEx,WS_EX_TRANSPARENT,addr ListboxCLass,addr szText02, \
WS_CHILD or WS_VISIBLE or WS_VSCROLL or LBS_SORT or LBS_HASSTRINGS or \
LBS_NOINTEGRALHEIGHT or WS_TABSTOP or WS_BORDER or WS_DISABLED,25,170,130,155,\
hWnd,ListboxID,hInstance,NULL
mov hListbox01,eax
call InsertColumn


InsertColumn proc
LOCAL lvc:LV_COLUMN
mov lvc.imask,LVCF_TEXT+LVCF_WIDTH
mov lvc.pszText,offset Heading1
mov lvc.lx,50
invoke SendMessage,hListbox01, LVM_INSERTCOLUMN,0,addr lvc
mov lvc.pszText,offset Heading2
invoke SendMessage,hListbox01, LVM_INSERTCOLUMN, 1 ,addr lvc
ret
InsertColumn endp



regards,
coredump
Posted on 2003-11-30 23:53:50 by coredump
Hi,

I am afraid you 've mixed up two different controls; ListBox with ListView. You create your window as a listbox but you try to insert columns to it as if it were a ListView.

Regards,

akyprian
Posted on 2003-12-01 00:01:52 by akyprian
hi akyprian,

thank you..ok i will change it:

.data
ListviewCLass db "SysListView32",0 ; i rename listboxclass
.data?
hList dd ?



[size=9]
invoke CreateWindowEx,WS_EX_STATICEDGE,addr ListviewCLass,\
addr szText02,WS_CHILD or WS_VISIBLE or WS_VSCROLL or LBS_SORT or\
LVS_REPORT or WS_TABSTOP or WS_BORDER,\
25,170,130,155,hWnd,ListviewID,hInstance,NULL
mov hList,eax

call InsertColumn



InsertColumn proc
LOCAL lvc:LV_COLUMN
mov lvc.imask,LVCF_TEXT+LVCF_WIDTH
mov lvc.pszText,offset Heading1
mov lvc.lx,50
invoke SendMessage,hList, LVM_INSERTCOLUMN,0,addr lvc
mov lvc.pszText,offset Heading2
invoke SendMessage,hList, LVM_INSERTCOLUMN, 1 ,addr lvc
ret
InsertColumn endp

[/size]



can you tell me what is the problem?
Posted on 2003-12-01 02:11:32 by coredump
Hi,

1.LBS_SORT is not a listview style it is a listbox style-->Use LVS_SORTASCENDING instead.


2.Use

mov lvc.imask,LVCF_TEXT+LVCF_WIDTH
mov lvc.pszText,offset Heading1
mov lvc.lx,50
MOV lvc.cchTextMax,MAX_PATH

Regards,

akyprian
Posted on 2003-12-01 02:43:07 by akyprian
hi akyprian,

thank you! i just change the LBS_SORT to LVS_SORTASCENDING ..
now the its ok..




regards,
coredump
Posted on 2003-12-01 03:08:01 by coredump