当前位置:网站首页>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;
}
边栏推荐
- Epoll and IO multiplexing of redis
- Onie supports pice hard disk
- The difference between TS Gymnastics (cross operation) and interface inheritance
- 23. Update data
- DataX self check error /datax/plugin/reader/_ drdsreader/plugin. Json] does not exist
- (lightoj - 1410) consistent verbs (thinking)
- Nc204382 medium sequence
- [1. Delphi foundation] 1 Introduction to Delphi Programming
- 数据治理:数据质量篇
- CF1036C Classy Numbers 题解
猜你喜欢
Comparison of usage scenarios and implementations of extensions, equal, and like in TS type Gymnastics
octomap averageNodeColor函数说明
Epoll and IO multiplexing of redis
Risk planning and identification of Oracle project management system
珠海金山面试复盘
Games101 Lesson 7 shading 1 Notes
Three no resumes in the software testing industry. What does the enterprise use to recruit you? Shichendahai's resume
数据治理:主数据的3特征、4超越和3二八原则
The ECU of 21 Audi q5l 45tfsi brushes is upgraded to master special adjustment, and the horsepower is safely and stably increased to 305 horsepower
Apache middleware vulnerability recurrence
随机推荐
[computer skills]
Common functions for PHP to process strings
The ECU of 21 Audi q5l 45tfsi brushes is upgraded to master special adjustment, and the horsepower is safely and stably increased to 305 horsepower
How to delete all the words before or after a symbol in word
TS 类型体操 之 循环中的键值判断,as 关键字使用
智能终端设备加密防护的意义和措施
Circuit breaker: use of hystrix
Machine learning - decision tree
[factorial inverse], [linear inverse], [combinatorial counting] Niu Mei's mathematical problems
Data governance: 3 characteristics, 4 transcendence and 3 28 principles of master data
二叉树创建 & 遍历
Emo diary 1
[nonlinear control theory]9_ A series of lectures on nonlinear control theory
[cf gym101196-i] waif until dark network maximum flow
Notes on software development
esRally国内安装使用避坑指南-全网最新
[KMP] template
2.10transfrom attribute
Data governance: Data Governance under microservice architecture
A Closer Look at How Fine-tuning Changes BERT