gpt4 book ai didi

c++ - 选项卡控件 : How to prevent the selection from changing?

转载 作者:行者123 更新时间:2023-11-27 23:00:23 25 4
gpt4 key购买 nike

我的项目是带有选项卡控件的简单 WIN32 对话框。在某些情况下,我想阻止用户更改选项卡。女士documentation非常简单 -

Returns TRUE to prevent the selection from changing, or FALSE to allow the selection to change.

但是,这是行不通的!

代码:

	case WM_NOTIFY:
if (((LPNMHDR)lParam)->idFrom == IDC_DEVTABS)
{
if (((LPNMHDR)lParam)->code == TCN_SELCHANGING)
return (INT_PTR)TRUE;
//return (INT_PTR)OnSelChanging(hDlgTab);
if (((LPNMHDR)lParam)->code == TCN_SELCHANGE)
OnSelChanged(hDlgTab);

return (INT_PTR)TRUE;
}

我可以看到我的父对话框收到了消息,但无论如何选项卡都在变化。知道如何防止标签更改吗?

最佳答案

如果您的控件在对话框中,正如我假设的那样,您需要通过 DWLP_MSGRESULT 窗口数据返回值。

SetWindowLongPtr(hWndDlg, DWLP_MSGRESULT, TRUE);
return TRUE;

对话过程的返回值向对话管理器指示消息是否已被处理。消息的实际返回值通过 DWLP_MSGRESULT 提供。

一如既往,请参阅 Raymond's blog对此进行很好的讨论。

关于c++ - 选项卡控件 : How to prevent the selection from changing?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/28339190/

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