CNetworkTreeCtrl

CNetworkTreeCtrl

By Paolo Messina

Sample Image - sample.gif

CNetworkTreeCtrl

This is just an example of a content provider class (see the article CWaitingTreeCtrl), 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 be used as the root of the tree control, as well as what kind of resources to be shown 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 can 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
Collapse
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 the 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
Collapse
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 the article).

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

License

This article has no explicit license attached to it but may contain usage terms in the article text or the download files themselves. If in doubt please contact the author via the discussion board below.

A list of licenses authors might use can be found here

About the Author

Paolo Messina


Paolo began programming at the age of 9 with a glorious 8086 and GW-BASIC, then he played a bit with C, ASM and Pascal. He tought himself MFC and Windows programming, to exploit his studies of C++. Always attracted by low-level programming and Assembly, he's beginning to appreciate the joys of templates and STL.

He lives in Follonica, Italy.

He has been abroad in the U.S. to work on his final thesis before graduating. For seven months he was playing with airplanes and automatic control at the Unversity of Illinois at Urbana-Champaign.

He graduated in Computer Science Engineering at the University of Pisa, Italy, in December 2003.

Currently working for an edutainment robotics company (www.robotechsrl.com).
Occupation: Software Developer
Company: RoboTech srl
Location: Italy Italy

From: http://www.codeproject.com/KB/tree/networktreectrl.aspx
【基于AT89C51单片机的交通灯系统】是电子工程领域中的一个经典实践项目,尤其适合初学者进行单片机编程和硬件控制的学习。AT89C51是一款广泛应用的8位微处理器,由美国Atmel公司生产,具有4KB的可编程Flash存储器,可以执行各种控制任务,包括交通灯系统的控制。 交通灯控制系统是城市交通管理的重要组成部分,通过红绿黄三色灯的变化来指示行人和车辆何时通行。在本项目中,交通灯系统采用AT89C51单片机作为核心控制器,通过编程实现红绿黄灯的定时切换,确保交通流畅且安全。 DSN(Design Suite Notation)文件,如`C51交通灯.DSN`,通常是在电路设计软件,如Keil uVision或Proteus中创建的工程文件。这种文件包含了整个项目的配置信息,包括源代码、元器件库、仿真设置等,使得开发者可以在虚拟环境中对交通灯系统进行仿真测试。Proteus是一款强大的电子电路仿真软件,可以直观地模拟硬件电路的行为,无需物理硬件即可验证设计的正确性。 数码管(7段显示器)是显示倒计时的关键部件。在这个项目中,数码管用于显示每个灯组的剩余时间,增强用户交互体验,使驾驶员和行人能够清晰了解何时转换灯色。AT89C51通过串行或并行接口与数码管连接,并通过特定的驱动程序代码控制数码管的显示内容。 编程方面,AT89C51使用C51语言编写,这是一种为8051系列单片机定制的C语言变体。代码中包含的详细注释对于初学者理解程序逻辑至关重要,通过注释可以学习如何设置定时器、中断服务子程序以及I/O端口操作,这些都是单片机编程的基础知识。 交通灯的控制通常基于定时器中断,例如,可以设置一个定时器在特定周期后触发中断,然后在中断服务程序中改变灯的状态。此外,为了实现数码管显示,可能需要用到移位寄存器和译码器等外围设备,这些都需要在代码中进行编程控制。 这个项目涵
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值