TVM_SETBKCOLOR和TREEVIEW_SETBKCOLOR在此范围中未声明
TVM_SETBKCOLOR and TreeView_SetBkColor not declared in this scope?
我会得到奇怪的范围错误:'TVM_SETBKCOLOR' was not declared in this scope
和类似的'TreeView_SetBkColor' was not declared in this scope
。我不知道为什么会发生这种情况:
- 我包括
commctrl.h
- 其他树景宏正常工作(例如
TreeView_DeleteItem
) - 自动完成识别并完成
TreeView_SetBkColor
,因此这不是拼写问题 - 我阅读了文档很好
这是来自适用窗口的片段。一切正常,直到我尝试更改tvw_filelist_
变量的背景。
void PnlTree::Init(HWND hwnd0, const char * superclassname0) {
tvw_filelist_ = CreateWindowEx (0,
superclassname0, NULL,
TVS_HASLINES | TVS_LINESATROOT | TVS_HASBUTTONS | WS_CHILD | WS_VISIBLE,
0, 0, 0, 0,
hwnd0, (HMENU) IDC_TVWFILELIST, NULL, NULL
);
txt_blurb0_ = CreateWindowEx (0,
TEXT("STATIC"), "Drag files and folders into this pane.",
SS_CENTER | SS_CENTERIMAGE | WS_CHILD | WS_VISIBLE,
0, 0, 0, 0,
hwnd0, NULL, NULL, NULL
);
txt_blurb1_ = CreateWindowEx (0,
TEXT("STATIC"), "Press DELETE to remove an entry.",
SS_CENTER | SS_CENTERIMAGE | WS_CHILD | WS_VISIBLE,
0, 0, 0, 0,
hwnd0, NULL, NULL, NULL
);
HFONT hFont = CreateFont(15, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, "Segoe UI");
::SendMessage(txt_blurb0_, WM_SETFONT, (WPARAM) hFont, 0);
::SendMessage(txt_blurb1_, WM_SETFONT, (WPARAM) hFont, 0);
// Everything works perfectly, if this line is commented out.
TreeView_SetBkColor(tvw_filelist_, RGB(235, 235, 235));
}
//
//
//
void PnlTree::RemoveItem(WPARAM wParam) {
if (wParam == VK_DELETE) {
TreeView_DeleteItem(tvw_filelist_, TreeView_GetSelection(tvw_filelist_));
}
}
我也尝试了
::SendMessage(tvw_filelist_, TVM_SETBKCOLOR, 0, RGB(235, 235, 235));
但是我遇到了相同的错误。发生了什么事?
(环境:code :: blocks,mingw,win7 x64)
仅当应用程序指定Internet Explorer 4或更高版本必须在目标系统上安装Internet Explorer 4时,才定义了TVM_SETBKCOLOR消息及其关联的TreeView_setBkColor()宏。
> > > >换句话说,_WIN32_IE
预处理器符号必须设置为0x0400
或更大。
标题文件的相关部分(Windows SDK版本7.0a中的CommCtrl.h
行5752至5792)是:
#if (_WIN32_IE >= 0x0400)
/* [get/set item height...] */
#define TVM_SETBKCOLOR (TV_FIRST + 29)
#define TreeView_SetBkColor(hwnd, clr)
(COLORREF)SNDMSG((hwnd), TVM_SETBKCOLOR, 0, (LPARAM)(clr))
#define TVM_SETTEXTCOLOR (TV_FIRST + 30)
#define TreeView_SetTextColor(hwnd, clr)
(COLORREF)SNDMSG((hwnd), TVM_SETTEXTCOLOR, 0, (LPARAM)(clr))
#define TVM_GETBKCOLOR (TV_FIRST + 31)
#define TreeView_GetBkColor(hwnd)
(COLORREF)SNDMSG((hwnd), TVM_GETBKCOLOR, 0, 0)
#define TVM_GETTEXTCOLOR (TV_FIRST + 32)
#define TreeView_GetTextColor(hwnd)
(COLORREF)SNDMSG((hwnd), TVM_GETTEXTCOLOR, 0, 0)
/* [get/set scroll time...] */
/* [get/set insert mark color...] */
#endif /* (_WIN32_IE >= 0x0400) */
相关文章:
- 为什么在全局范围内使用"extern int a"似乎不行?
- 尝试通过多个向量访问变量时,向量下标超出范围
- 错误:未在此范围内声明'reverse'
- 正在将指针转换为范围
- 使用std::transform将一个范围的元素添加到另一个范围中
- 在基于范围的for循环中使用结构化绑定声明
- 如何计算数据类型的范围,例如int
- 为什么 const std::p air<K,V>& 在 std::map 上基于范围的 for 循环不起作用?
- 在C++中查找范围的长度
- 如何设置一个范围来提取我想要获得的信息
- 并行用于C++17中数组索引范围内的循环
- 为左值和右值的包装器实现C++范围
- 求出有多少个数字是完美平方,而sqrt()是L,R范围内的素数
- 关于:C++中异常对象的范围:为什么我没有得到副本?
- 超出范围时使用对象
- 不计算一个范围内的完美数
- ";结果类型必须是可从输入范围的值类型""构造的;创建std::vector时
- 基于范围的 for 循环:迭代使用一个元素扩展的向量
- 如何访问超出其块范围的对象?
- 矢量下标超出SFML游戏中的范围