News:

Masm32 SDK description, downloads and other helpful links
Message to All Guests

Main Menu

Listview columns - determining number of, at runtime

Started by K_F, February 27, 2013, 08:01:00 PM

Previous topic - Next topic

K_F

I don't see anything in the API list.. similar to LVM_GETITEMCOUNT.

Is the only way to determine the number, is to cycle through LVM_GETCOLUMN's  until the API fails ?
:lol:

Sorry: I forgot to mention that the LV is in report/details view format.

'Sire, Sire!... the peasants are Revolting !!!'
'Yes, they are.. aren't they....'

sinsi

Community content from http://msdn.microsoft.com/en-us/library/windows/desktop/bb761044(v=vs.85).aspx
Quote from: Reetep
Counting the number of columns

To count the number of columns, rather than the number of items (ie
rows), use the LVM_GETHEADER message to obtain a handle to the listview's
header. The header admits the admits the HDM_GETITEMCOUNT message, which returns the number of columns in the listview.

K_F

As far as I understand that message, is that it returns the Total Rows in the LV ....that is, Items only (column 0) and not the Subitems

There doesn't seem to be anything similar for Total Columns
:)
'Sire, Sire!... the peasants are Revolting !!!'
'Yes, they are.. aren't they....'

sinsi

"Item" in this case means a column. The header control is separate from (but part of) the listview control.

http://msdn.microsoft.com/en-us/library/windows/desktop/hh298343(v=vs.85).aspx
QuoteA header control typically has several header items that define the columns of the control.

One way to find out.

K_F

'Sire, Sire!... the peasants are Revolting !!!'
'Yes, they are.. aren't they....'