gpt4 book ai didi

c++ - 列表框通知

转载 作者:塔克拉玛干 更新时间:2023-11-03 00:05:28 25 4
gpt4 key购买 nike

我有两个控件的对话框: TreeView 列表框。我的对话框也有消息处理程序。

 case WM_NOTIFY:
{
switch(LOWORD(wParam))
{
case IDC_LIST1: //we NEVER comes here
if(((LPNMHDR)lParam)->code == NM_CLICK)
{
//do some work;
return (INT_PTR)TRUE;
}
break;
case IDC_TREE1:
if(((LPNMHDR)lParam)->code == NM_DBLCLK)
{
//do some work;
return (INT_PTR)TRUE;
}
break;
}
}
break;

所以,我不明白为什么来自树框的通知成功到达,但是来自列表框的通知永远不会到达,尽管在列表框控件的属性中设置了 Notify 值 <强>正确 。谢谢你。

最佳答案

让我们检查文档。

List Box Styles :

LBS_NOTIFY

Causes the list box to send a notification code to the parent window whenever the user clicks a list box item (LBN_SELCHANGE), double-clicks an item (LBN_DBLCLK), or cancels the selection (LBN_SELCANCEL).

LBN_SELCHANGE :

Notifies the application that the selection in a list box has changed as a result of user input. The parent window of the list box receives this notification code through the WM_COMMAND message.

LBN_DBLCLK :

Notifies the application that the user has double-clicked an item in a list box. The parent window of the list box receives this notification code through the WM_COMMAND message.

LBN_SELCANCEL :

Notifies the application that the user has canceled the selection in a list box. The parent window of the list box receives this notification code through the WM_COMMAND message.

结论:列表框使用WM_COMMAND通知父级,而不是WM_NOTIFY

关于c++ - 列表框通知,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/9679531/

25 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com