c++ - 在 Visual Studio 2019 中将布尔变量作为参数传递给需要 BOOL 参数的函数
问题描述
拿这个示例代码:
void CChristianLifeMinistryDiscussionsDlg::SetControlStates()
{
if (m_pEntry == nullptr)
return;
bool bClass1 = false, bClass2 = false;
m_pEntry->GetAuxiliaryClasses(bClass1, bClass2);
m_cbBrothersC1.EnableWindow(bClass1 ? TRUE : FALSE);
m_cbBrothersC2.EnableWindow(bClass2 ? TRUE : FALSE);
}
EnableWindow
需要一个类型的参数BOOL
。我永远不清楚在这种情况下只传递我的bool
变量的值是否可以接受。
解决方案
推荐阅读
- javascript - 如何根据反应表中firestore中的值设置复选框的默认状态
- android - Three.JS:来自聚光灯的奇怪阴影工件,但仅在 Android 中
- python - 在 python 中从 MySQL 中选择值的正确语法是什么?
- javascript - 在 JS 中为在屏幕上移动的矩形设置动画的最简单方法是什么?
- android - 是否可以忽略特定语言环境以在 Android Studio 中使用 lint 进行翻译?
- python - Python网络抓取“IndexError:列表索引超出范围”
- python - Matplotlib 直方图未正确计算每个 bin 中值的数量
- swift - Realm Swift 对象在每个 JSON 序列化上都重复
- dafny - 为什么我们在描述 forall 时在 dafny 中使用蕴涵而不是共轭?
- javascript - 在 html 文件中调用的脚本最终会引用 localhost 地址而不是本地文件夹