本帖最后由 yhxhappy 于 2010-12-1 18:57 编辑
拿CLASS替换标题没理由不成功的,除非你填的不对
楼主提的问题太泛泛了,又没有截图或代码之类的分析,我们什么知道你的窗口CLASS是什么,进程名是什么,下面的代码你自己研究吧,逆过来就行了#include <WinAPI.au3>
#Include <WinAPIEx.au3>
#include <GUIConstantsEx.au3>
#include <GuiListView.au3>
;创建主窗口
$GUI = GUICreate("EnumWindows", 1000, 700)
;绘制并生成数据表
$listview = GUICtrlCreateListView("", 15, 10, 970, 640)
_GUICtrlListView_SetExtendedListViewStyle($listview, BitOR($LVS_REPORT, $LVS_EX_FULLROWSELECT))
_GUICtrlListView_AddColumn($listview, "窗口句柄", 85)
_GUICtrlListView_AddColumn($listview, "窗口标题", 450)
_GUICtrlListView_AddColumn($listview, "窗口文本", 250)
;_GUICtrlListView_AddColumn($listview, "CLASS", 50)
_GUICtrlListView_AddColumn($listview, "PID", 55)
_GUICtrlListView_AddColumn($listview, "进程名称", 100)
;刷新按钮
$Installa_Button = GUICtrlCreateButton("刷新", 835, 655, 150, 35)
AddListviewItem()
GUISetState()
While 1
$msg = GUIGetMsg()
Switch $Msg
Case $GUI_EVENT_CLOSE
Exit
Case $Installa_Button
AddListviewItem()
EndSwitch
WEnd
Func AddListviewItem()
_GUICtrlListView_DeleteAllItems($listview)
$aWindows = _WinAPI_EnumWindows()
For $i = 1 To $aWindows[0][0]
$WindowHandle = $aWindows[$i][0]
$WindowsClass = $aWindows[$i][1]
$WindowTitle = WinGetTitle($aWindows[$i][0])
$WindowText = WinGetText($aWindows[$i][0])
$ProcessPID = WinGetProcess($aWindows[$i][0])
$e = StringSplit(_WinAPI_GetModuleFileNameEx($ProcessPID), "") ;提取进程名称,也可以取进程的路径
$ProcessName = $e[$e[0]]
If $WindowTitle <> "" Then GUICtrlCreateListViewItem($WindowHandle & "|" & $WindowTitle& "|" & $WindowText & "|" & $ProcessPID & "|" & $ProcessName, $listview) ;如果窗口标题为空,则不添加进表格,去掉判断则会全部添加
Next
EndFunc
|