How can I not catch the return key in CListCtrl's Lvn_keydown event?

Source: Internet
Author: User

Original link: http://computer-programming-forum.com/81-vc/c92ab6e6d6ac92bc.htm

Landlord

How do I handle the return key on a ClistCtrl? I ' ve tried to intercept
The Lvn_keydown message but the Return key was not handled!!! I ' ve Also
Tried to intercept the Nm_return message but it doesn ' t work
Thanks in advance.
O.ferrandiz

2 floor

You need to override PreTranslateMessage to trap the WM_KEYDOWN (Vk_return)
Message like so:

BOOL
CListCtrlEx::P retranslatemessage (msg* pMsg)
{
if (((GetStyle () & lvs_editlabels) = = 0) | | (Pmsg->message! = wm_keydown)
|| (Pmsg->wparam! = Vk_return))
Return CListCtrl::P retranslatemessage (PMSG);

Send the message on to the control
DispatchMessage (PMSG);
return TRUE;

}

Note that you don ' t need to call TranslateMessage () If you are only need the
Wm_keydown message, as-function only causes a WM_CHAR (Vk_return)
Message to is sent to your handler. Now you ' ll get the wm_notify (Nm_return)
Messages.

How can I not catch the return key in CListCtrl's Lvn_keydown event?

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.