Click to See Complete Forum and Search --> : How can I detect when user click on ListView's item ?


Drago
October 26th, 1999, 11:40 AM
Hello,
I use Win32 simple application withough MFC support. It's only ListView control. It is create by CreateWindowEx(). What can I get message when user click on some item in this ListView. I tried to get WM_NOTIFY but it failed. I try this:

MSG msg;
HWND hWnd = CreateWindowEx(...);

while(::GetMessage(&msg, hWnd, 0, 0))
{
switch (msg.message)
{
case WM_NOTIFY:
{
MessageBox("User send NOTIFY message");
break;
}
TranslateMessage(&msg);
DispatchMessage(&msg);
}
}

The problem is that I never see this MessageBox().
When I tried with other messages like WM_KEYDON, WM_CHAR, WM_CLOSE everythig is OK. So I wrong something in WM_NOTIFY code, but WHERE??
Please help me !!
Thank you in advance.

Regards: Drago

BobClarke
October 26th, 1999, 12:56 PM
Have you tried WM_COMMAND? I don't know if the listview was part of Win 3.1 in any form, but I believe the older controls continue to respond to WM_COMMAND messages. Just a thought...

Drago
October 26th, 1999, 03:15 PM
Hi,
Thats right but in MFC implementation most ListView messages are send with WM_NOTIFY.
But I'll try WM_COMMAND.

Reagrds: Drago