darklight 发表于 2009-7-17 09:34:58

怎样获得Treeview的图标呢?请各位多指教

本帖最后由 darklight 于 2009-7-17 09:54 编辑

现在在做个监控系统,想监控图中的图标变化(连通状态和断开状态图标不同),如图,左面是个treeview,帮助中似乎只有这两个函数与此有关,但在实验中不能起作用,不知道各位有什么好的方法能够提取这种图标信息?
$h_image = _GUICtrlTreeView_GetImageListIconHandle($h_tree,12)
$h_image = _GUICtrlTreeView_GetStateImageList($h_tree)
写了一个获取资源管理器左边栏的测试程序,还是不行,不知道各位有什么好的方法,请多多指教
#include <GuiImageList.au3>
#include <GuiTreeView.au3>
#include <GuiImageList.au3>
                $TdxTitle = "我的电脑"
                $TdxTitle = WinGetTitle($TdxTitle);
                MsgBox(0,"",$TdxTitle)
                $h_tree = ControlGetHandle($TdxTitle, "",100)
                MsgBox(0,"",$h_tree)
                $h_image1 = _GUICtrlTreeView_GetImageListIconHandle($h_tree,1)
                $h_image2 = _GUICtrlTreeView_GetStateImageList($h_tree)
                MsgBox(0, "Information",$h_image1)
                MsgBox(0, "Information",$h_image2)

darklight 发表于 2009-7-17 14:09:52

自己顶一下,貌似还有一个 _GUICtrlTreeView_GetNormalImageList函数可用,虽然返回的handle不是空了,但是返回的_GUIImageList_GetImageCount($h_image)总是空,不知道怎么回事
$h_image1 = _GUICtrlTreeView_GetNormalImageList($h_tree1)

zconant 发表于 2009-7-17 16:19:46

要不楼主试试取图片的某坐标像素呢?这样应该就可以简单识别图片了吧~

darklight 发表于 2009-7-18 11:01:06

像素貌似位置变换太大,有获取treeview的image方法么?

darklight 发表于 2009-7-19 09:12:31

真心求教啊,大家有会的么?

lynfr8 发表于 2009-7-19 16:21:33

测试过了
非AU3创建的Treeview
很难啊
因为不是自己创建的
ITEM的句柄都无法获取

darklight 发表于 2009-7-19 22:25:57

哦,谢谢lynfr8,看来是不行了,找找其他方法吧
页: [1]
查看完整版本: 怎样获得Treeview的图标呢?请各位多指教