问题如题!给予详细解答或者参考者均可得分!谢谢!

解决方案 »

  1.   

    我需要树形控件的树形显示功能啦,就像资源管理器那样的!参考MFC的CTreeCtrl的实现太难了吧,我是用的SDK编程呀!
      

  2.   

    有人做过类似的程序吗?我在很多关于SDK的参考书上没有找到树形控件的例子,请问这个控件是不是Windows的标准控件呀?
      

  3.   

    /*-----------------------------------------------
    CreateTreeViewIN:      hWnd   - Handle to parent windowNOTE:   Create the tree and list view
          controls for the main window
    -----------------------------------------------*/
    void CreateViews(HWND hWnd)
    {
    DIGWFolder* pDIGWFolder;
    DIGWTrash* pDIGWTrash;
    IGWFolder* pIGWFolder;
    HTREEITEM hTreeItem = NULL;
    TV_INSERTSTRUCT tvis;
    HICON hiconItem;         
    HIMAGELIST himlSmall;
    BSTR bstrTrashName;   InitCommonControls();   // Create TreeView Control
       hWndTView = CreateWindowEx(WS_EX_CLIENTEDGE, WC_TREEVIEW, "TreeView",
                   WS_VISIBLE | WS_CHILD | TVS_HASLINES | TVS_DISABLEDRAGDROP | TVS_HASBUTTONS,
                   1, 10, 155, 244, hWnd, (HMENU)IDC_TREEVIEW, ghInst, NULL);   // Create ListView Control
       hWndLView = CreateWindowEx(WS_EX_CLIENTEDGE, WC_LISTVIEW, "ListView",
                   WS_VISIBLE | WS_CHILD | LVS_REPORT,
                   160, 10, 434, 244, hWnd, (HMENU)IDC_LISTVIEW, ghInst, NULL);   InitLViewColumns();
        himlSmall = ImageList_Create(GetSystemMetrics(SM_CXSMICON),
                   GetSystemMetrics(SM_CYSMICON), TRUE, 2, 2); 
     
        hiconItem = LoadIcon(ghInst, MAKEINTRESOURCE(IDI_OPENED)); 
        ImageList_AddIcon(himlSmall, hiconItem); 
        DeleteObject(hiconItem);    hiconItem = LoadIcon(ghInst, MAKEINTRESOURCE(IDI_CLOSED)); 
        ImageList_AddIcon(himlSmall, hiconItem); 
        DeleteObject(hiconItem);
     
        // Assign the image lists to the list view control. 
        ListView_SetImageList(hWndLView, himlSmall, LVSIL_SMALL); 
       // Get the Root Folder
       if(SUCCEEDED(pIGWAccount->get_RootFolder(&pDIGWFolder))) {
          if(pDIGWFolder && SUCCEEDED(pDIGWFolder->QueryInterface(IID_IGWFolder, (void**)&pIGWFolder))) {
             pDIGWFolder->Release();
             InsertSubFolders(pIGWFolder, hTreeItem);
             // Need to add the Trash folder seperatly since it is 
             // not contained under the root folder         pIGWAccount->get_Trash(&pDIGWTrash);         if(pDIGWTrash && SUCCEEDED(pDIGWTrash->QueryInterface(IID_IGWTrash, (void**)&pIGWTrash))) {
                pDIGWTrash->Release();            pIGWTrash->get_Name(&bstrTrashName);            hTreeItem = TreeView_GetRoot(hWndTView);            tvis.hParent = hTreeItem;
                tvis.item.mask = TVIF_TEXT | TVIF_PARAM;
                tvis.item.pszText = FROM_OLE_STRING(bstrTrashName);            SysFreeString(bstrTrashName);            TreeView_InsertItem(hWndTView, &tvis);
             }
          }
       }   // Exand the tree from root level   
       TreeView_Expand(hWndTView, hTreeItem, TVM_EXPAND);
    }
      

  4.   

    我还以为你要自己实现一个树型控件呢?如果只是使用使用树形控制件MSDN上详细的说明。
      

  5.   

    当然是要自己实现一个树型控件啦,因为我是用的SDK编程,而它又不是一个标准的WINDOWS控件,所以只能是自己写代码来实现它!
      

  6.   

    我想重申一遍:我使用的是WIN32 SDK编写界面的,不是用MFC。所以没有现成的树型控件可以使用,需要自己写代码来实现!
      

  7.   

    common control 中有一个Treeview控件,就是一个树形控件,没不要自己去实现,直接用就行了。它是SDK的一部分。
    包含commctrl.h在连接时加入comctl32.lib就行了,
    建创一个TreeView控件上面有位兄弟己经说了,MSDN上也有例子,你可以看看:
         Tree View Controls
    这篇文章讲得很详细。
      

  8.   

    它是一个公用控件,可用CreateWindowEx创建,在创建之前得调用  InitCommonControlsEx具体看MSDN中platform sdk documentation->user interface services->windows common controls->Tree View Controls的说明,
    创建后可向它发送消息来操纵它,可通过wm_notify消息得到它的能知消息.