I'm getting the strange scope error: 'TVM_SETBKCOLOR' was not declared in this scope
and similar 'TreeView_SetBkColor' was not declared in this scope
. I can't figure out why this is happening:
- I have included
commctrl.h
- Other treeview macros work fine (like
TreeView_DeleteItem
) - Autocomplete recognizes and finishes
TreeView_SetBkColor
so it's not a spelling problem - I read the documentation pretty well
Here's a snippet from the applicable window. Everything is working fine, until I try to change the background of the tvw_filelist_
variable.
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_));
}
}
I've also tried
::SendMessage(tvw_filelist_, TVM_SETBKCOLOR, 0, RGB(235, 235, 235));
but I get the same error. What's going on?
(Environment: Code::Blocks, MinGW, Win7 x64)