TreeView Controls - HTREEVIEW
I'm new to win32 API programming and I try to understand source code of treeview from codeproject.
But I really don't understand thi开发者_如何学运维s :
BOOL TreeView::DoNotify(HWND hWnd, UINT msg, WPARAM wParam, LPARAM lParam)
{
// blah blah
HTREEVIEW Selected = (HTREEITEM)SendDlgItemMessage(hWnd,ID_TREE,TVM_GETNEXTITEM,TVGN_CARET,(LPARAM)Selected);
// halb halb
}
It doesn't work ( Selected is used without initializing) until I declare Selected as global variable.
Thanks for reading this and I need your help .
TVM_GETNEXTITEM with TVGN_CARET does not use the LParam (So you can just pass NULL). You can verify this by looking at the macro for the same action:
#define TreeView_GetSelection(hwnd) TreeView_GetNextItem(hwnd, NULL, TVGN_CARET)
精彩评论