The Code Project View our sponsorsClick here for Whole Tomato Software - Home of Visual AssistAdvertise on the CodeProject
Home >> Tree Controls >> 'Populate-on-Demand' Tree Controls

CNetworkTreeCtrl
By Paolo Messina

A CWaitingTreeCtrl-derived class to display network resources 
 VC 4-6, Win95-98, NT4, W2K, MFC
 Posted 17 Oct 2000
Articles by this author
Send to a friend
Printer friendly version
Lounge New Articles Sign in Forums Contribute
Broken links? Email us!
4 users have rated this article. result:
5 out of 5.

  • Download source files - 4 Kb
  • Download demo project - 36 Kb
  • Sample Image - sample.gif

    CNetworkTreeCtrl

    This is just an example of a content provider class (see article), which overrides the PopulateItem virtual function to show network resources only when the user wants to access them.

    You may specify the network resource to use as the root of the tree control, as well as what kind of resources to show in the last level. You may also get specific information about the network resource associated with an existing item. To communicate with the class you use the standard NETRESOURCE structure and related flags.

    User interface features are those offered by the base class and can be further personalized with custom animations.

    Class Reference

    CNetworkTreeCtrl::RefreshNetworkRoot
    BOOL RefreshNetworkRoot(LPNETRESOURCE pRoot, DWORD dwStopAtDisplayType = RESOURCEDISPLAYTYPE_GENERIC)

    It associates a network resource with the root item and refreshes the tree items in the first level. It also sets what kind of container resources must not be further enumerated.

    The first argument pRoot is the address of the network resource you want as root of the tree control. A value of NULL means the network root.

    The dwStopAtDisplayType argument could take the same values as the dwDisplayType field of the NETRESOURCE structure. It specifies the last level of network resources that will be visible in the tree control.

    The return value is TRUE if you specified a valid resource, FALSE otherwise.

    CNetworkTreeCtrl::GetItemResource
    BOOL GetItemResource(HTREEITEM hItem, LPNETRESOURCE pNr)

    It retrieves the network resource associated to the specified item. If successful, the return value is TRUE and the structure pointed by pNr contains valid data, otherwise the return value is FALSE.

    Updates

    [ Today ]
    Initial public release.

    Conclusion

    Please note that this class is not fully functional. So far it can be used only in a dialog, but I will work on it when I have more time. I released this version to provide an example of a content provider for my CWaitingTreeCtrl class (see article).

    Any help or suggestion would be greatly appreciated. I plan to use this control in a new version of our NetSend utility, see www.geocities.com/ppescher/productions.html. Also the latest beta releases of this class could be found there, for test only purpose.

    About Paolo Messina

    Paolo is a student of Computer Engineering at the University of Pisa.
    He began programming with a glorious 8086 and GW-BASIC, then he played a bit with C, ASM and Pascal. Now he's trying to learn MFC and Windows programming.
    He lives in Follonica, Italy 42°55'19"N 10°45'35"E.

    Click here to visit Paolo Messina's homepage.

    [Top] Sign in to vote for this article:     PoorExcellent  
    Hint: For improved responsiveness, use Internet Explorer 4 (or above) with Javascript enabled, choose 'Use DHTML' from the View dropdown and hit 'Set Options'.
     Keyword Filter
     View   Per page   Messages since
    New threadTotal Messages for this article: 0 
    Subject 
    Author 
    Date 
    -- No entries present --

    Home >> Tree Controls >> 'Populate-on-Demand' Tree Controls
    last updated 17 Oct 2000
    Article content copyright Paolo Messina, 2000
    everything else © CodeProject, 1999-2001.
    The Code Project View our sponsorsGet your new domain name now!Advertise on the CodeProject