Treeview的API全集(2)-----www.mvps.org

thorkhan thorkhan 墨衍会员 · AI 创作全网分发 墨衍智能分发 通过墨衍一键同步至各平台 可同步平台 CSDN微信公众号微博知乎掘金百家号博客园抖音小红书 你的文章也可以这样分发 墨衍会员 ¥399起/年,写一次发全网 我也要 + 加入社区
Declare Function SendMessage Lib "user32" Alias "SendMessageA" _
(ByVal hwnd As Long, _
ByVal wMsg As Long, _
wParam As Any, _
lParam As Any) As Long ' <--- !!
'

' Inserts a new item in a tree-view control.
' Returns the handle to the new item if successful or 0 otherwise.

Public Function TreeView_InsertItem(hwnd As Long, lpis As TVINSERTSTRUCT) As Long
TreeView_InsertItem = SendMessage(hwnd, TVM_INSERTITEM, 0, lpis)
End Function

' Removes an item from a tree-view control.
' Returns TRUE if successful or FALSE otherwise.

Public Function TreeView_DeleteItem(hwnd As Long, hItem As Long) As Boolean
TreeView_DeleteItem = SendMessage(hwnd, TVM_DELETEITEM, 0, ByVal hItem)
End Function

' Removes all items from a tree-view control.
' Returns TRUE if successful or FALSE otherwise.

Public Function TreeView_DeleteAllItems(hwnd As Long) As Boolean
TreeView_DeleteAllItems = SendMessage(hwnd, TVM_DELETEITEM, 0, ByVal TVI_ROOT)
End Function

' Expands or collapses the list of child items, if any, associated with the specified parent item.
' Returns TRUE if successful or FALSE otherwise.
' (docs say TVM_EXPAND does not send the TVN_ITEMEXPANDING and
' TVN_ITEMEXPANDED notification messages to the parent window...?)

Public Function TreeView_Expand(hwnd As Long, hItem As Long, flag As TVM_EXPAND_wParam) As Boolean
TreeView_Expand = SendMessage(hwnd, TVM_EXPAND, ByVal flag, ByVal hItem)
End Function

' Retrieves the bounding rectangle for a tree-view item and indicates whether the item is visible.
' If the item is visible and retrieves the bounding rectangle, the return value is TRUE.
' Otherwise, the TVM_GETITEMRECT message returns FALSE and does not retrieve
' the bounding rectangle.

Public Function TreeView_GetItemRect(hwnd As Long, hItem As Long, prc As RECT, fItemRect As CBoolean) As Boolean
prc.Left = hItem
TreeView_GetItemRect = SendMessage(hwnd, TVM_GETITEMRECT, ByVal fItemRect, prc)
End Function

' Returns the count of total items in a tree-view control.

Public Function TreeView_GetCount(hwnd As Long) As Long
TreeView_GetCount = SendMessage(hwnd, TVM_GETCOUNT, 0, 0)
End Function

' Retrieves the amount, in pixels, that child items are indented relative to their parent items.
' Returns the amount of indentation.

Public Function TreeView_GetIndent(hwnd As Long) As Long
TreeView_GetIndent = SendMessage(hwnd, TVM_GETINDENT, 0, 0)
End Function

' Sets the indentation pixel width for a tree-view control and redraws the control to reflect the new width.
' No return value.

Public Sub TreeView_SetIndent(hwnd As Long, iIndent As Long)
Call SendMessage(hwnd, TVM_SETINDENT, ByVal iIndent, 0)
End Sub

' Retrieves the handle to the normal or state image list associated with a tree-view control.
' Returns the handle to the image list.

Public Function TreeView_GetImageList(hwnd As Long, iImage As Long) As Long
TreeView_GetImageList = SendMessage(hwnd, TVM_GETIMAGELIST, ByVal iImage, 0)
End Function

' Sets the normal or state image list for a tree-view control and redraws the control using the new images.
' Returns the handle to the previous image list, if any, or 0 otherwise.

Public Function TreeView_SetImageList(hwnd As Long, himl As Long, iImage As Long) As Long
TreeView_SetImageList = SendMessage(hwnd, TVM_SETIMAGELIST, ByVal iImage, ByVal himl)
End Function

' ======= Begin TreeView_GetNextItem ===========================================

' Retrieves the tree-view item that bears the specified relationship to a specified item.
' Returns the handle to the item if successful or 0 otherwise.

Public Function TreeView_GetNextItem(hwnd As Long, hItem As Long, flag As Long) As Long
TreeView_GetNextItem = SendMessage(hwnd, TVM_GETNEXTITEM, ByVal flag, ByVal hItem)
End Function

' Retrieves the first child item. The hitem parameter must be NULL.
' Returns the handle to the item if successful or 0 otherwise.

Public Function TreeView_GetChild(hwnd As Long, hItem As Long) As Long
TreeView_GetChild = TreeView_GetNextItem(hwnd, hItem, TVGN_CHILD)
End Function

' Retrieves the next sibling item.
' Returns the handle to the item if successful or 0 otherwise.

Public Function TreeView_GetNextSibling(hwnd As Long, hItem As Long) As Long
TreeView_GetNextSibling = TreeView_GetNextItem(hwnd, hItem, TVGN_NEXT)
End Function

' Retrieves the previous sibling item.
' Returns the handle to the item if successful or 0 otherwise.

Public Function TreeView_GetPrevSibling(hwnd As Long, hItem As Long) As Long
TreeView_GetPrevSibling = TreeView_GetNextItem(hwnd, hItem, TVGN_PREVIOUS)
End Function

' Retrieves the parent of the specified item.
' Returns the handle to the item if successful or 0 otherwise.

Public Function TreeView_GetParent(hwnd As Long, hItem As Long) As Long
TreeView_GetParent = TreeView_GetNextItem(hwnd, hItem, TVGN_PARENT)
End Function

' Retrieves the first visible item.
' Returns the handle to the item if successful or 0 otherwise.

Public Function TreeView_GetFirstVisible(hwnd As Long) As Long
TreeView_GetFirstVisible = TreeView_GetNextItem(hwnd, 0, TVGN_FIRSTVISIBLE)
End Function

' Retrieves the next visible item that follows the specified item. The specified item must be visible.
' Use the TVM_GETITEMRECT message to determine whether an item is visible.
' Returns the handle to the item if successful or 0 otherwise.

Public Function TreeView_GetNextVisible(hwnd As Long, hItem As Long) As Long
TreeView_GetNextVisible = TreeView_GetNextItem(hwnd, hItem, TVGN_NEXTVISIBLE)
End Function

' Retrieves the first visible item that precedes the specified item. The specified item must be visible.
' Use the TVM_GETITEMRECT message to determine whether an item is visible.
' Returns the handle to the item if successful or 0 otherwise.

Public Function TreeView_GetPrevVisible(hwnd As Long, hItem As Long) As Long
TreeView_GetPrevVisible = TreeView_GetNextItem(hwnd, hItem, TVGN_PREVIOUSVISIBLE)
End Function

' Retrieves the currently selected item.
' Returns the handle to the item if successful or 0 otherwise.

Public Function TreeView_GetSelection(hwnd As Long) As Long
TreeView_GetSelection = TreeView_GetNextItem(hwnd, 0, TVGN_CARET)
End Function
...全文

相关推荐

C++与Qt+OpenCV打造图像处理桌面软件:从灰度化到Canny边缘检测

图像处理是计算机视觉的基础,涵盖灰度化、二值化、滤波与边缘检测四大经典操作。灰度化将彩色图像压缩为单通道亮度信息,二值化通过OTSU自适应阈值实现前景背景分离,均值滤波用于去除噪声却需权衡细节保留,而边缘检测则依赖梯度计算与Canny算法的非极大值抑制。在实际工程中,C++结合Qt与OpenCV是高效实现这些算法的常见技术栈,既能保证性能,又能构建直观的图形界面。此类技能广泛应用于OCR、缺陷检测、轮廓提取等场景。本文以一款图像处理桌面软件为例,详细介绍环境配置、界面设计、算法实现与Mat-QImage转换

weixin_34413103

【无人车路径跟踪】基于神经网络的数据驱动迭代学习控制(ILC)算法,用于具有未知模型和重复任务的非线性单输入单输出(SISO)离散时间系统的无人车的路径跟踪(Matlab代码实现)

内容概要:本文系统解读了一套用于多机器人路径规划(MAPF)的MATLAB代码库,聚焦于优先级规划算法的设计与实现。该框架采用四层架构——几何解析、拓扑构建、调度规划与可视化呈现,有效分离空间路径搜索与时间冲突消解过程,提升算法效率与可扩展性。核心机制包括动态边权膨胀、节点预留历史与几何惩罚驱动的局部同步策略,前者通过软惩罚引导后续智能体绕行而非硬封锁路径,后者利用哈希结构与前向信息传递优化冲突检测效率。同时引入Petri网建模方法,将路径冲突问题转化为整数规划中的容量约束问题,支持对解的存在性与最优性进行形式化分析。文章详述了优先级启发式策略(如路径长度、冲突程度排序)、冲突检测与消解机制,并提供完整的仿真与动画输出功能,便于算法验证与教学演示。; 适合人群:具备一定编程基础和算法知识,从事机器人路径规划、智能交通、自动化调度等相关领域的研究人员、研究生及工程技术人员(尤其适合有MATLAB使用经验者)。; 使用场景及目标:①用于仓储物流、无人机编队、自动驾驶等多智能体系统的路径规划研究与仿真验证;②作为MAPF教学案例,帮助理解优先级规划、冲突消解、Petri网建模等核心概念;③为复杂调度系统开发提供模块化设计参考。; 阅读建议:建议结合文中提供的代码结构与流程图逐步实现各模块功能,重点关注动态边权膨胀与时间同步机制的设计逻辑,可通过调整启发式策略与地图参数进行实验对比,深入理解算法性能与局限性。

@橘柑橙柠桔柚

求职简历模板30套(Word可编辑)

【内容概要】求职简历模板30套(Word可编辑)。本资源为可编辑源文件,含配套模板与实操指引,覆盖求职者的核心使用场景,拿到即可直接修改使用。 【适用人群】求职者。 【使用场景及目标】快速套用,节省从零搭建的时间成本。 【其他说明】文件为可编辑格式,无软件依赖,下载后可直接使用。

2401_84445501

光伏+储能+并网逆变+发电系统【含建模笔记+参考文献等】

内容概要:本文档围绕“光伏+储能+并网逆变+发电系统”的建模与仿真展开,系统性地涵盖了光伏发电最大功率点跟踪(MPPT)、储能系统能量管理、并网逆变控制及多源协调运行等关键技术环节。基于Matlab/Simulink平台,实现了从光伏阵列、储能单元到并网逆变器的整体系统建模,重点展示了三闭环矢量控制、PID控制、模型预测控制(MPC)等多种先进控制策略在新能源发电系统中的应用与对比。文档不仅聚焦于单一组件的建模,更强调系统级的协同控制与稳定性分析,整合了微电网优化调度、电力电子变换器控制、状态估计、卡尔曼滤波、车间调度算法等多领域技术资源,形成了一份内容详实、覆盖面广的综合性技术资料,为新能源领域的科研、教学与工程实践提供有力支撑。; 适合人群:具备电力电子、自动控制、新能源发电或电气工程等相关专业背景,从事相关领域研究的研究生、高校教师、科研人员及电力系统工程技术人员。; 使用场景及目标:①深入学习并掌握光伏-储能-并网发电系统的全流程建模与仿真技术;②理解并应用矢量控制、MPC等先进控制算法解决实际电力系统中的动态响应与稳定性问题;③获取丰富的Matlab/Simulink仿真模型、代码及参考文献,用于完成科研课题、学位论文、课程设计或工程项目开发。; 阅读建议:此资源内容丰富且涵盖多个独立技术主题,建议读者根据自身的研究方向和实际需求,选择性地深入学习特定章节。应重点研读系统建模方法、控制算法的设计原理与参数整定过程,并务必结合所提供的仿真代码进行动手实践、调试与结果分析,以深化对理论知识的理解并提升工程应用能力。

ssswww56

基于8051控制LCD12864B(ST7920控制器)液晶屏,分别用字库调用和图片调用方式显示《七律·长征》和《十六字令三首》

1.运行环境Proteus 8.9.根据安装的路径,先将动态链接库和库文件拷到对应目录下。举例:我的Proteus 8 Professional是安装在D盘;把“LCD12864B.dll”拷贝到D:\Program Files (x86)\Labcenter Electronics\Proteus 8 Professional\DATA\MODELS目录下;把“LCD7920.IDX”、“LCD7920.LIB”这两个文件拷贝到D:\Program Files (x86)\Labcenter Electronics\Proteus 8 Professional\DATA\LIBRARY目录下。 2.8051的工程可用KEILC51完全汉化版编译生成目标代码 3.12864字模工具.exe是取字模软件,一屏信息以图片形式取模,形成数据 4.IC_DAT生成器.exe也是取字模软件,输入汉字,可生成基于字库调用的数据 5.以上例程,用硬件开发板调试正常 6.LCD12864B.dll是基于LCD12864a.dll修改后生成的,解决仿真时字符显示有残留的问题

xsp3741
评论 4
收藏 已收藏
分享
返回顶部
thorkhan
API 1,488 成员 23,270 内容