当前位置:网站首页>MFC 给列表控件发送左键单击、双击、以及右键单击消息
MFC 给列表控件发送左键单击、双击、以及右键单击消息
2022-07-06 07:50:00 【donghuangliuyun】
void CTestsetting::SendClickToList()
{
NMITEMACTIVATE NMItemActive;
NMHDR thdr;
thdr.code = NM_CLICK; //NM_CLICK单击 NM_DBLCKL 双击 NM_RCLICK右键单击
thdr.hwndFrom = m_TestsetList.m_hWnd; //m_TestList是列表控件关联的变量
thdr.idFrom = IDC_TESTSETTING_LIST; //IDC_TESTSETTING_LIST 列表控件ID
NMItemActive.hdr = thdr;
NMItemActive.iItem = m_TestsetList.GetItemCount();
NMItemActive.iItem = 0; //设置选中第几行
NMItemActive.iSubItem = 1; //设置选中第几列
m_TestsetList.SetSelectionMark(0);
SendMessage(WM_NOTIFY, IDC_TESTSETTING_LIST, (LPARAM)&NMItemActive); //把消息发送给列表所在地父窗口,由父窗口转发,而不是直接转发给列表
}
添加列表左键单击响应函数
void CTestsetting::OnNMClickTestsettingList(NMHDR* pNMHDR, LRESULT* pResult)
{
//因为是测试所以是随便写的变量
LPNMITEMACTIVATE temp = (LPNMITEMACTIVATE)pNMHDR;//将传进来的消息转换成LPNMITEMACTIVAT
int nItem = temp->iItem;//获得行号
int nSubItem = temp->iSubItem;//获得列号
TRACE("%d, %d\n", nItem, nSubItem);
*pResult = 0;
}
边栏推荐
- Luogu p4127 [ahoi2009] similar distribution problem solution
- [factorial inverse], [linear inverse], [combinatorial counting] Niu Mei's mathematical problems
- ROS learning (IX): referencing custom message types in header files
- octomap averageNodeColor函数说明
- PHP Coding Standard
- Luogu p1836 number page solution
- 烧录场景下的源代码防泄密方案分享
- Data governance: 3 characteristics, 4 transcendence and 3 28 principles of master data
- 上线APS系统,破除物料采购计划与生产实际脱钩的难题
- shu mei pai
猜你喜欢
Compliance and efficiency, accelerate the digital transformation of pharmaceutical enterprises, and create a new document resource center for pharmaceutical enterprises
2.10transfrom attribute
Related operations of Excel
jmeter性能测试步骤实战教程
Apache middleware vulnerability recurrence
继电反馈PID控制器参数自整定
Sharing of source code anti disclosure scheme under burning scenario
Pre knowledge reserve of TS type gymnastics to become an excellent TS gymnastics master
In the era of digital economy, how to ensure security?
QT color is converted to string and uint
随机推荐
2022年Instagram运营小技巧简单讲解
Codeforces Global Round 19(A~D)
Linked list interview questions (Graphic explanation)
Brief explanation of instagram operation tips in 2022
How to delete all the words before or after a symbol in word
Rust language - receive command line parameter instances
Cf1036c class numbers solution
二叉树创建 & 遍历
861. Score after flipping the matrix
edge浏览器 路径获得
数据治理:主数据的3特征、4超越和3二八原则
Secure captcha (unsafe verification code) of DVWA range
[window] when the Microsoft Store is deleted locally, how to reinstall it in three steps
leecode-C語言實現-15. 三數之和------思路待改進版
[computer skills]
DataX self check error /datax/plugin/reader/_ drdsreader/plugin. Json] does not exist
Méthode d'obtention des propriétés de l'objet JS (.Et [] méthodes)
How to estimate the number of threads
MEX有关的学习
Generator Foundation