I have a listview procedure that I need updated every few seconds. The procedure takes a user-added memory address and reads the value at the address then puts all of it into a listview in an organized manner (Description, address, value = 1 row). My procedure works fine however, I want to set a timer so it will update the value every few seconds. The code that I have looks something like this:
Now this all works fine but you have to keep selecting the listview area in order for the value to refresh. Any ideas on how to get it to refresh withut having to select the listview area? Any help is appreciated.
RIF
invoke SetTimer,hWnd,4,100,ADDR LoadValue
LoadValue proc uses esi
LOCAL lvi:LV_ITEM
invoke GetDlgItem,hWnd,1001
mov hList2,eax
invoke SendMessage,hList2,LVM_GETITEMCOUNT,0,0
mov esi,eax
.while esi != 0
dec esi
mov lvi.imask,LVIF_TEXT
mov lvi.pszText,offset itemcount
mov lvi.iItem,esi
mov lvi.iSubItem,1
invoke SendMessage,hList2,LVM_GETITEMTEXT,esi,addr lvi
invoke htodw,addr itemcount
mov itemcount,eax
invoke ReadProcessMemory,editprocess,itemcount,addr val2,4,NULL
invoke wsprintf,addr val3,addr format3,val2
mov lvi.imask, LVIF_TEXT
mov lvi.pszText,offset val3
mov lvi.iSubItem, 2
invoke SendMessage, hList2, LVM_SETITEM, 0, ADDR lvi
.endw
ret
LoadValue endp
Now this all works fine but you have to keep selecting the listview area in order for the value to refresh. Any ideas on how to get it to refresh withut having to select the listview area? Any help is appreciated.
RIF
perhaps calling invalidaterect on the listview window would do it?
Look into UpdateWindow and RedrawWindow for forcing a redraw.
Thanks man UpdateWindow worked perfect. Just set two timers. One for a window update and the other for the regular LoadValue proc.