WM of the control

xiaoxiao2021-03-06  40

WM_NOTIFY message mapping

A few days ago, I tried to map HDN_BEGINTRACK this WM_NOTIFY message in ClistCtrl.

Easily built a message map with ClassWizard, which has completed all the jobs after all work, but I can't make it easy for a long time.

The message is not mapped! !

Begin_MESSAGE_MAP (CPREVLIST, CListCtrl) // {{AFX_MSG_MAP (CPREVLIST) ON_NOTIFY_REFLECT (HDN_BEGINTRACK, ONBEGINTRACK / /}} AFX_MSG_MAPEND_MESSAGE_MAP ()

void CPrevList :: OnBegintrack (NMHDR * pNMHDR, LRESULT * pResult) {HD_NOTIFY * phdn = (HD_NOTIFY *) pNMHDR; // TODO: Add your control notification handler code here AfxMessageBox ( "finally mapped on!"); // program Can't do this * pRESULT = 0;}

Since then, I have worked hard on this issue for a long time, and I found two solutions.

1. Map of message twice, respectively, XXXXW and XXXXA

BEGIN_MESSAGE_MAP (CPrevList, CListCtrl) // {{AFX_MSG_MAP (CAdvHeaderCtrl) // NOTE - the ClassWizard will add and remove mapping macros here //}.} AFX_MSG_MAP ON_NOTIFY_REFLECT (HDN_BEGINTRACKW, OnBeginTrack) ON_NOTIFY_REFLECT (HDN_BEGINTRACKA, OnBeginTrack) END_MESSAGE_MAP ()

2, heavy duty CWnd :: ONNOTIFY virtual function is handled in it to XXXXW and XXXXA respectively

Bool Cprevlist :: ONNOTIFY (WPARAM WPARAM, LRESULT * PRESULT) {Switch ((nmHDR *) LPARAM) -> CASE HDN_BEGINTRACKW: CASE HDN_BEGINTRACKA:

AfxMessageBox ("finally mapped");

}

Return Clistctrl :: ONNOTIFY (WPARAM, LPARAM, PRESULT);

The production of antispectural problems is completely a disaster that the operating system is provoked, my operating system is Win2K (VC6 no SP)

Win2K uses Wide Char, it is often said to Unicode, and the message in Win2k corresponds to WM_XXXXWWW.

Early Win9X uses ASCII, the message is WM_XXXXA.

To use the WM_NOTIFY message that uses some controls, you must do your own processing ...

转载请注明原文地址:https://www.9cbs.com/read-73517.html

New Post(0)