当前位置:网站首页>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;
}
边栏推荐
- Codeforces Global Round 19(A~D)
- TS类型体操 之 字符串的妙用
- Méthode d'obtention des propriétés de l'objet JS (.Et [] méthodes)
- Related operations of Excel
- 23. Update data
- Helm install Minio
- Significance and measures of encryption protection for intelligent terminal equipment
- 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
- Mex related learning
- Type of data in energy dashboard
猜你喜欢

链表面试题(图文详解)

QT color is converted to string and uint

【Redis】NoSQL数据库和redis简介

Parameter self-tuning of relay feedback PID controller

Three no resumes in the software testing industry. What does the enterprise use to recruit you? Shichendahai's resume

23. Update data

How to delete all the words before or after a symbol in word

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

继电反馈PID控制器参数自整定

Apache middleware vulnerability recurrence
随机推荐
C # display the list control, select the file to obtain the file path and filter the file extension, and RichTextBox displays the data
Get the path of edge browser
Full Score composition generator: living on code
Apache middleware vulnerability recurrence
Simulation of Teman green interferometer based on MATLAB
Document 2 Feb 12 16:54
A Closer Look at How Fine-tuning Changes BERT
ROS learning (IX): referencing custom message types in header files
Helm install Minio
继电反馈PID控制器参数自整定
What are the ways to download network pictures with PHP
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
TS 类型体操 之 extends,Equal,Alike 使用场景和实现对比
Linked list interview questions (Graphic explanation)
DataX self check error /datax/plugin/reader/_ drdsreader/plugin. Json] does not exist
解决方案:智慧工地智能巡检方案视频监控系统
Methods for JS object to obtain attributes (. And [] methods)
07- [istio] istio destinationrule (purpose rule)
Luogu p4127 [ahoi2009] similar distribution problem solution
Secure captcha (unsafe verification code) of DVWA range