hwndTreeView = CreateWindowEx( WS_EX_WINDOWEDGE,//WS_EX_CLIENTEDGE,// ex style WC_TREEVIEW, // class name defined in commctrl.h NULL, // window text dwStyle, // style 320, // x position 120, // y position TV_WIDTH, // width TV_HEIGHT, // height hwndParent, // parent (HMENU)IDC_TREEVIEW, // ID (HINSTANCE)GetWindowLong(hwndParent, GWL_HINSTANCE), // instance NULL); // no extra data // if(hwndTreeView) { InitTreeView(hwndTreeView); return hwndTreeView; } else { return NULL; } } MFC: 资源中拖一个tree,就有了。
#define TV_WIDTH 200
#define TV_HEIGHT 200
//
HWND CreateTreeView(HINSTANCE hInstance, HWND hwndParent)
{
DWORD dwStyle;
HWND hwndTreeView;
BOOL bSuccess = TRUE;dwStyle = WS_TABSTOP | WS_CHILD | WS_BORDER | WS_VISIBLE ;//
hwndTreeView = CreateWindowEx( WS_EX_WINDOWEDGE,//WS_EX_CLIENTEDGE,// ex style
WC_TREEVIEW, // class name defined in commctrl.h
NULL, // window text
dwStyle, // style
320, // x position
120, // y position
TV_WIDTH, // width
TV_HEIGHT, // height
hwndParent, // parent
(HMENU)IDC_TREEVIEW, // ID
(HINSTANCE)GetWindowLong(hwndParent, GWL_HINSTANCE), // instance
NULL); // no extra data
//
if(hwndTreeView)
{
InitTreeView(hwndTreeView);
return hwndTreeView;
}
else
{
return NULL;
}
}
MFC:
资源中拖一个tree,就有了。
你说的ID号又是什么呢?