#SingleInstance Force
#Persistent
; http://www.autohotkey.com/board/topic/81820-how-to-get-specific-row-text-in-a-syslistview32-easily/#entry522080
row := 1 ; Какую строку читать
ControlGet, handle, Hwnd, , SysListView321, ahk_class µTorrent4823DF041B09
; ControlGet, handle, Hwnd, , SysListView321, ahk_class Progman
; У меня не работает на рабочем столе
ControlGet, CountCol, List,Count Col,, ahk_id %handle%
Loop % CountCol
Text .= LvGetText(handle, row, A_Index) . (A_Index = CountCol ? "" : " | ")
MsgBox % Text
LvGetText(hListView,r=1,c=1)
{
r--, ntemp := dwProcessId := 0
DllCall("GetWindowThreadProcessId", UInt,hListView, UIntP,dwProcessId)
hProcess := DllCall("OpenProcess", UInt,0x001F0FFF, Int,false, UInt,dwProcessId) ; 0x001F0FFF = PROCESS_ALL_ACCESS
lpProcessBuf1 := DllCall("VirtualAllocEx", UInt,hProcess, UInt,ntemp, UInt,28, UInt,0x1000, UInt,4)
; 28 = size of lvItem, 0x1000 = MEM_COMMIT, 4 = PAGE_READWRITE
lpProcessBuf2 := DllCall("VirtualAllocEx", UInt,hProcess, UInt,ntemp, UInt,512, UInt,0x1000, UInt,4) ; text buffer
VarSetCapacity(t, 511, 1)
VarSetCapacity(lvItem, 28)
NumPut(1, lvItem, "uint") ; mask
NumPut(0, lvItem, A_PtrSize, "int") ; iItem 0 means the first row; anyhow, when sending the LVM_GETITEMTEXT message, we can specify a different item
NumPut(c-1, lvItem, A_PtrSize * 2, "int") ; iSubItem 0 means the first column
NumPut(lpProcessBuf2, lvItem, A_PtrSize * 5, "ptr") ; pszText
NumPut(512, lvItem, A_PtrSize * 6) ; cchTextMax
DllCall("WriteProcessMemory", UInt,hProcess, UInt,lpProcessBuf1, UInt,&lvItem, UInt,28, UInt,ntemp)
DllCall("SendMessage", "uint", hListView, "uint", (A_IsUnicode ? 0x1000 + 0x73 : 0x1000 + 0x2D), "uint", r, "ptr", lpProcessBuf1)
DllCall("ReadProcessMemory", UInt,hProcess, UInt,lpProcessBuf2, UInt,&t, UInt,512, UInt,ntemp)
DllCall("VirtualFreeEx", UInt,hProcess, UInt,lpProcessBuf1, UInt,0, UInt,0x8000) ; 0x8000 = MEM_RELEASE
DllCall("VirtualFreeEx", UInt,hProcess, UInt,lpProcessBuf2, UInt,0, UInt,0x8000)
DllCall("CloseHandle", UInt,hProcess)
return t
}
Esc::
ExitApp