Hello,
I need to update an existing listview owned by another process,
ExtListView lib "Cyruz" seems to get item text, i want to set text same way i could set text (LVM_SETITEMTEXT) & Dll calls....?
"Text := ExtListView_GetItemText(this.JLV, A_Index - 1, nCol)"
if possible may be some one could help me writing "LVM_SETITEMTEXT" function as i can't do it on my own (consider me as noob in LVITEM and dll calls), please help me
thanks in advance.
Need help in external listview set item Topic is solved
-
- Posts: 46
- Joined: 04 Dec 2017, 00:11
Re: Need help in external listview set item Topic is solved
As an addition to the ExtListView library you can try the following:
I did not test it.
Code: Select all
; ----------------------------------------------------------------------------------------------------------------------
; Function .....: ExtListView_SetItemText
; Description ..: Set the text of the desired item.
; Parameters ...: objLV - External ListView initialized object.
; ..............: sText - The text to set.
; ..............: nRow - Row of the desired item (0-based index).
; ..............: nCol - Column of the desired item (0-based index).
; Return .......: Item content as a string.
; ----------------------------------------------------------------------------------------------------------------------
ExtListView_SetItemText(ByRef objLV, ByRef sText, nRow, nCol) {
VarSetCapacity( LVITEM, objLV.szwritebuf, 0 )
NumPut( 0x0001, LVITEM, 0 ) ; mask = LVIF_TEXT = 0x0001.
NumPut( nRow, LVITEM, 4 ) ; iItem = Row to retrieve (0 = 1st row).
NumPut( nCol, LVITEM, 8 ) ; iSubItem = The column index of the item to retrieve.
NumPut( objLV.preadbuf, LVITEM, 20 + (A_PtrSize - 4) ) ; pszText = Pointer to item text string.
NumPut( objLV.szreadbuf, LVITEM, 20 + ((A_PtrSize * 2) - 4) ) ; cchTextMax = Number of TCHARs in the buffer.
VarSetCapacity( sBuf, objLV.szreadbuf, 0 )
StrPut( sText, &sBuf, objLV.senc )
If ( !DllCall( "WriteProcessMemory", Ptr,objLV.hproc, Ptr,objLV.pwritebuf, Ptr,&LVITEM, UInt,objLV.szwritebuf
, UInt,0 ) )
Throw Exception("objLV.pwritebuf: error writing memory", "WriteProcessMemory", "LastError: " A_LastError)
If ( !DllCall( "WriteProcessMemory", Ptr,objLV.hproc, Ptr,objLV.preadbuf, Ptr,&sBuf, UInt,objLV.szreadbuf
, UInt,0 ) )
Throw Exception("objLV.preadbuf: error writing memory", "WriteProcessMemory", "LastError: " A_LastError)
; LVM_SETITEMTEXTA = 0x102E ; (LVM_FIRST + 46)
; LVM_SETITEMTEXTW = 0x1074 ; (LVM_FIRST + 116)
LVM_SETITEMTEXT := (objLV.senc == "UTF-8" || objLV.senc == "UTF-16") ? 0x1074 : 0x102E
SendMessage, %LVM_SETITEMTEXT%, %nRow%, % objLV.pwritebuf,, % "ahk_id " objLV.hlv
Return ErrorLevel
}
-
- Posts: 46
- Joined: 04 Dec 2017, 00:11
Re: Need help in external listview set item
Hi,
just me,
Your function is working like a charm, i would never have guessed what you did,
Thanks for taking your time and solving puzzle just like that, you definitely saved a lot of time for me.
Thanks a million
i almost forgot Thanks a lot "Cyruz" for providing "ExtListView" lib.
just me,
Your function is working like a charm, i would never have guessed what you did,
Thanks for taking your time and solving puzzle just like that, you definitely saved a lot of time for me.
Thanks a million
i almost forgot Thanks a lot "Cyruz" for providing "ExtListView" lib.
Re: Need help in external listview set item
You're welcome!
Who is online
Users browsing this forum: Bing [Bot], Chunjee, Hansielein, Lpanatt and 329 guests