Thread Rating:
  • 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
Read Value in SysListView32
#1
sample ListView:
OrderID          Date                 Category          Pack       ProductID       Price
1234567        2008.01.15       Furniture          20          FN239404       $125.5
1234568        2008.01.17       Electronics       125        EL124124       $65.74
1234569        2008.01.18       Stationary       1785       ST523234      $12.25

It's posible to read the detail in ListView using macro?
ex. need to know the detail in col 2 then my macro can click the row correctly in ListView.
Try using Accessible object action, the control is SysListView32 and only can detect the row, not the value in cell.
need help please.
#2
Normally accessible object's Description contains text of all cells in the row, plus column header text. Needs to parse the string to get text of a cell.

header1: cell1 text; header2: cell2 text; ...

Or use function GetListViewItemText.
#3
Can some one help me, how to use parse or GetListViewItemText to get value from Listbox(SysListView32).
Thanks for the help.
#4
Example with GetListViewItemText
Code:
Copy      Help
int hwnd=child("" "SysListView32" win("" "ExploreWClass") 0x1)
str s
GetListViewItemText hwnd 3 s 2 ;;get text of 4-th item (item index 3), 3-d column (column index 2)
out s

Example with accessible objects
Code:
Copy      Help
Acc c=acc("" "LISTITEM" win("" "ExploreWClass") "SysListView32" "" 0x1001)
str s=c.Description
out s
ARRAY(str) a; int i
if(findrx(s "^.+?: (.+?)[,;] .+?: (.+?)[,;] .+?: (.+)" 0 0 a)<0) ret
for i 0 a.len
,out a[i]
,

Each method has advantages and disadvantages. The first is reliable and fast but does not work in exe. The second works in exe but is unreliable because text of some items may be empty or contain separators.

----

This example shows all items and cells
Code:
Copy      Help
int hwnd=child("" "SysListView32" win("" "ExploreWClass") 0x1)
str s; int r c
for r 0 SendMessage(hwnd LVM_GETITEMCOUNT 0 0)
,out "--- row %i ---" r
,for c 0 5
,,if(!GetListViewItemText(hwnd r s c)) s=""
,,out s
#5
Thanks for the help Gintaras, but still can not read the value,
using method no.3 to show all items and cells, the result can count the total line, but the item in cell is blank, try using method 2 and 1 still same blank also.
do i need another options parameters in syntac line?
need your assist, thank you.
#6
Then probably QM cannot get cell text.

What exactly is in QM output after you run the codes?
#7
Thanks for the help Gintaras, but still can not read the value,
using method no.3 to show all items and cells, the result can count the total line, but the item in cell is blank, try using method 2 and 1 still same blank also.
do i need another options parameters in syntac line?
need your assist, thank you.


Attached Files Image(s)
   
#8
How can I export all items of SysListView32 including headers to excel?
#9
Create CSV file. Use ICsv interface for it.
Get header item text with accessible object functions.
Get listview item/subitem text with GetListViewItemText.
Item count = SendMessage(hlv LVM_GETITEMCOUNT 0 0).
#10
If I know the handle of SysListView32, how can I know the handle of SysHeader32?

I looking for a function to extract all text of SysListView32+SysHeader32.
#11
LVM_GETHEADER
#12
Ok.

SysHeader32 handle=SendMessage(hlv LVM_GETHEADER 0 0)
#13
How can I add the SysHeader32 text to

Function LvGetAll2
Code:
Copy      Help
;/
function! hlv ARRAY(str)&a

int nc=SendMessage(SendMessage(hlv LVM_GETHEADER 0 0) HDM_GETITEMCOUNT 0 0)
int nr=SendMessage(hlv LVM_GETITEMCOUNT 0 0)
if(!nr or !nc) ret
int r c

a.create(nc nr)
for r 0 nr
,for c 0 nc
,,GetListViewItemText hlv r a[c r] c

ret 1
#14
Function LvGetAll2
Code:
Copy      Help
;/
function! hlv ARRAY(str)&a

int hd=SendMessage(hlv LVM_GETHEADER 0 0)
int nc=SendMessage(hd HDM_GETITEMCOUNT 0 0)
if(!nc) ret
int nr=SendMessage(hlv LVM_GETITEMCOUNT 0 0)
int r c

a.create(nc nr+1)
for r 0 nr
,for c 0 nc
,,GetListViewItemText hlv r a[c r+1] c

Acc ah=acc("" "LIST" hd)
for(ah.elem 1 nc+1) a[ah.elem-1 0]=ah.Name

ret 1

example
Macro Macro1401
Code:
Copy      Help
out
ARRAY(str) a
int w1=child(1001 "List4" "SysListView32" win("Winamp" "BaseWindow_RootWnd"))
int i j
LvGetAll2 w1 a
for i 0 a.len
,out "'%s'  '%s'  '%s'" a[0 i] a[1 i] a[2 i]
#15
Thanks.


Forum Jump:


Users browsing this thread: 1 Guest(s)