Google Groups no longer supports new Usenet posts or subscriptions. Historical content remains viewable.
Dismiss

ListView_SetCheckState()

141 views
Skip to first unread message

Asha Udupa

unread,
Jan 1, 2001, 4:23:34 AM1/1/01
to
Hi,
I am getting error for following stmt
ListView_SetCheckState(hwndList,itemno,TRUE );
As
error C2065: 'ListView_SetCheckState' : undeclared identifier.
i have included the required files & .libs.
Does anyone knows why?
also when i create a list view with checkbox ,state of the checkbox will be
unchecked,how do i make that as checked ?
TIA


Ajay Kalra

unread,
Jan 1, 2001, 5:16:57 AM1/1/01
to
You need commctrl.h. May be you have an older version of it. Check for this
in your header file and if you do not find it, download the latest from
micorosft's website.

--
Ajay Kalra [MVP - VC++]
ajay...@yahoo.com

Note: Please post all replies to newsgroup only.

Asha Udupa <as...@robosoftin.com> wrote in message
news:OxwWxR9cAHA.852@tkmsftngp04...

Asha Udupa

unread,
Jan 1, 2001, 5:46:15 AM1/1/01
to
I have VC++ 6.0 & win nt 4.0 .So i think i have the latest version.
Also all other function related to this (eg:ListView_GetCheckState()) works.
Is there anyother way to check an item in listview?
TIA

Ajay Kalra wrote in message ...

Ajay Kalra

unread,
Jan 3, 2001, 1:48:18 AM1/3/01
to
I was surprised that this macro is actually not defined in Commctrl.h. It is
defined in CommCtrl.h that ships with PlatformSDK. Here is its definition:

#if (_WIN32_IE >= 0x0300)
#define ListView_SetCheckState(hwndLV, i, fCheck) \
ListView_SetItemState(hwndLV, i, INDEXTOSTATEIMAGEMASK((fCheck)?2:1),
LVIS_STATEIMAGEMASK)
#endif

--
Ajay Kalra [MVP - VC++]
ajay...@yahoo.com

Note: Please post all replies to newsgroup only.

Asha Udupa <as...@robosoftin.com> wrote in message

news:e5yT#$9cAHA.1332@tkmsftngp05...

Asha Udupa

unread,
Jan 3, 2001, 4:23:50 AM1/3/01
to
I have included that macro defination.
Now i have a strange problem.
MSDN says,
ListView_SetCheckState( HWND hwndLV, UINT iIndex, BOOL fCheck);
here fCheck :Value that is set to TRUE to select the item, or FALSE to
deselect it.

But if i set fCheck to FALSE it selects the item & if i set that to TRUE it
deselects the item.
If i change the macro defination as


#if (_WIN32_IE >= 0x0300)
#define ListView_SetCheckState(hwndLV, i, fCheck) \

ListView_SetItemState(hwndLV, i, INDEXTOSTATEIMAGEMASK((fCheck)?1:2),
LVIS_STATEIMAGEMASK)
Then it works according to MSDN.
So i would like to know where is fault?
Asha

0 new messages