The MASM Forum Archive 2004 to 2012

General Forums => The Campus => Topic started by: Mr. Sade on January 08, 2007, 09:53:32 PM

Title: ListView and SubItems problem
Post by: Mr. Sade on January 08, 2007, 09:53:32 PM
I don't know where the error is.. can somebody help me.

i can add list view items but i can't add list view sub items.
this is part of my code



local item:LVITEM

mov item.imask, LVIF_TEXT
mov item.iItem, 0
mov item.iSubItem, 0
mov item.pszText, OFFSET szText
invoke SendDlgItemMessage, hMainWnd, 103, LVM_INSERTITEM, 0, addr item
mov item.iSubItem, 1
invoke SendDlgItemMessage, hMainWnd, 103, LVM_SETITEM, 0, addr item
mov item.iSubItem, 2
invoke SendDlgItemMessage, hMainWnd, 103, LVM_SETITEM, 0, addr item


ListView is inside my resource script, Style=report

thank you
Title: Re: ListView and SubItems problem
Post by: akane on January 08, 2007, 10:07:21 PM
I vote you do this inside WM_INITDIALOG, same problem here on xp 2002 sp2.
I solved this by posting a custom message WM_USER+3 from inside initdialog, and inside this custom message iI was able to add subitems.
Better way is to create non-modal dialog, then fill the list after CreateDialog.

// But at first, you must add one coulumn for each subitem: LVM_INSERTCOLUMN
Title: Re: ListView and SubItems problem
Post by: Mr. Sade on January 08, 2007, 10:48:25 PM
u are right if i put the code directly inside WM_INITDIALOG it works
but if the code is inside a procedure and i call this procedure isnide WM_INITDIALOG it wont work.

Title: Re: ListView and SubItems problem
Post by: Mr. Sade on January 08, 2007, 11:01:17 PM
i fixed it, stupid error!!
1 day trying to see what the problem was  :red