关于获取SysListView32控件问题
需求:获取Windows任务管理中任务列表框中的文本内容现状:使用窗口信息工具查询时,可见文本为空,使用_GUICtrlListView_GetItemTextString也读不到
进展:经过论坛查询和网上搜索,论坛中有大佬提出用【LVM_GETITEM消息获得列表项内容】,我在au3中没有查到这个函数,上网查到了windows应用开发当中有这个函数,但是自己学艺不精,不会用。
诉求:请大佬帮忙解决获取listview32列表框内容,或者说一说如果使用windows应用开发中的函数如何在au3中使用。
提前感谢大佬们了
https://www.autoitx.com/forum.php?mod=image&aid=38730&size=300x300&key=cbbafdfa41de52ef&nocache=yes&type=fixnonehttps://www.autoitx.com/forum.php?mod=image&aid=38731&size=300x300&key=bfce62b762d474ab&nocache=yes&type=fixnonehttps://www.autoitx.com/forum.php?mod=image&aid=38732&size=300x300&key=68924c977920192f&nocache=yes&type=fixnone
1. 第一個方案
#include <MsgBoxConstants.au3>
#include <array.au3>
Example()
Func Example()
Local $aProcessList = ProcessList()
_ArrayDisplay($aProcessList, "Run Process")
EndFunc ;==>Example2.第二個方案
#include <Array.au3>
_ArrayDisplay(_process(1))
Func _process($show = -1)
Local $dos
Switch $show
Case -1
$dos = Run(@ComSpec & " /c " & "tasklist /fo csv","",@SW_HIDE,15)
Local $processList = [["映像名称","PID","会话名","会话#","内存使用"]]
Case Else
$dos = Run(@ComSpec & " /c " & "tasklist /fo csv /v","",@SW_HIDE,15)
Local $processList = [["映像名称","PID","会话名","会话#","内存使用","状态","用户名","CPU时间","窗口标题 "]]
EndSwitch
ProcessWaitClose($dos)
Local $tasklist = StdoutRead($dos)
If $tasklist Then
$tasklist = StringReplace($tasklist,""",""","""|""")
$tasklist = StringReplace($tasklist,"""","")
Local $tasklist_line = StringSplit($tasklist,Chr(13))
For $i = 2 To $tasklist_line - 1;结尾多一行空白内容
If $tasklist_line[$i] Then
_ArrayAdd($processList,$tasklist_line[$i])
EndIf
Next
EndIf
Return $processList
EndFunc3.第三個方案, 論壇 搜索 進程 看看
曾经外置汉化某软件时的一段代码给你参考一下:
Case "Snapshot - Select the Volumes you want to save"
WinSetTitle($hWnd, "", "Snapshot - 选择要保存的卷")
ControlSetText($hWnd, "", "", "下一步(&N)")
ControlSetText($hWnd, "", "", "返回(&B)")
ControlSetText($hWnd, "", "", "选择要保存的卷")
ControlSetText($hWnd, "", "", "所有大小 MB(1024×1024)")
ControlSetText($hWnd, "", "", "帮助")
$Wnd = _WinAPI_EnumChildWindows($hWnd) ;<WinAPISysWin.au3>
For $i = 0 To UBound($Wnd) - 1
If $Wnd[$i] = 'SysListView32' Then
$Wnd = $Wnd[$i]
ExitLoop
EndIf
Next
Local $sSysListView32 = StringSplit("驱动|HD|分区号|分区开始|分区大小|标签|文件系统|大小|已用|可用", "|", 2)
For $i = 0 To UBound($sSysListView32) - 1
_GUICtrlListView_SetUnicodeFormat($Wnd, True)
_GUICtrlListView_SetColumn($Wnd, $i, $sSysListView32[$i]) ;<GuiListView.au3>
Next
For $i = 0 To _GUICtrlListView_GetItemCount($Wnd)
Local $sPartNo = _GUICtrlListView_GetItemText($Wnd, $i, 2)
If StringInStr($sPartNo, 'Pri') Then
_GUICtrlListView_SetItemText($Wnd, $i, '主分区' & StringTrimLeft($sPartNo, 3), 2)
EndIf
If StringInStr($sPartNo, 'Log') Then
_GUICtrlListView_SetItemText($Wnd, $i, '逻辑分区' & StringTrimLeft($sPartNo, 3), 2)
EndIf
Next
For $i = 0 To _GUICtrlListView_GetItemCount($Wnd)
Local $sLable = _GUICtrlListView_GetItemText($Wnd, $i, 5)
If StringInStr($sLable, 'Unknown') Then
_GUICtrlListView_SetItemText($Wnd, $i, '未知' & StringTrimLeft($sLable, 7), 5)
EndIf
Next
For $i = 0 To _GUICtrlListView_GetItemCount($Wnd)
Local $sFileSystem = _GUICtrlListView_GetItemText($Wnd, $i, 6)
If StringInStr($sFileSystem, 'Hidden') Then
_GUICtrlListView_SetItemText($Wnd, $i, StringTrimRight($sFileSystem, 6) & '隐藏', 6)
EndIf
Next
chishingchan 发表于 2024-11-8 08:15
曾经外置汉化某软件时的一段代码给你参考一下:
当年的“东方快车”就是典型的外置汉化,不知道为什么现在没有这类通用汉化软件了?在翻译软件和AI翻译横行的天下,外置汉化会非常方便啊? 应该是外置汉化跟不上时代了吧
这样?
页:
[1]