Can somebody post the C macros "ListView_GetCheckState" and it's cousin "ListView_GetItemState"?

There are assembly equivalents of a lot of these ListView macros, in WINDOWSX.INC (in EXAMPLE7/DDTEST) but these two are not among them.

I've been trying to do my own version, but I can't seem to get it right.

TIA
Posted on 2002-09-01 21:43:06 by The Worrier King
I've posted some common control macros.

ListView_xxx, Header_xxx & TreeView_xxx macros.

Strange, but nobody, except andycar via email, had interest.
And i stopped updating it.

ListView_GetCheckState MACRO hwnd:REQ, iItem:REQ

invoke SendMessage, hwnd, LVM_GETITEMSTATE, iItem, LVIS_STATEIMAGEMASK
shr eax, 12
dec eax
ENDM

ListView_GetItemState MACRO hwnd:REQ, i:REQ, mask:REQ
invoke SendMessage, hwnd, LVM_GETITEMSTATE, i, mask
ENDM

The collection of macros is bigger now.
I've written simple help and tuttor example "ListView with editable subitems"
I have to do some testing.
I'll post it maybe in a week or so.

...and it's cousin "ListView_GetItemState"

You may be mean ListView_SetCheckState. Need to be tested.

ListView_SetCheckState MACRO hwnd:REQ, i:REQ, fCheck:REQ

IF fCheck
ListView_SetItemState hwnd, i, $INDEXTOSTATEIMAGEMASK(2), LVIS_STATEIMAGEMASK
ELSE
ListView_SetItemState hwnd, i, $INDEXTOSTATEIMAGEMASK(1), LVIS_STATEIMAGEMASK
ENDIF
ENDM

$INDEXTOSTATEIMAGEMASK MACRO i:REQ
IF $IsImm(i)
EXITM <(i SHL 12)>
ELSE
IFDIFI <i>, <eax>
mov eax, i
ENDIF
shl eax, 12
EXITM <eax>
ENDIF
ENDM

$IsImm MACRO Operand:REQ
IF (OPATTR (Operand)) AND 00000100y
;; Is an immediate value
EXITM <-1>
ELSE
EXITM <0>
ENDIF
ENDM
Posted on 2002-09-02 01:33:03 by Four-F
Thanks Four-F, that was the information I needed. As usual, I was over-compicating things :rolleyes:

If you could, please post your most recent macro files, so I can integrate them into my program.
Posted on 2002-09-02 20:20:19 by The Worrier King
I don't want post it right now because of it's in non-consistent state.
And as i told above i have to do some check.
So, please wait.
Posted on 2002-09-03 01:55:11 by Four-F