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:

invoke SetTimer,hWnd,4,100,ADDR LoadValue

LoadValue proc uses esi
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
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.

Posted on 2005-03-21 16:37:35 by resistance_is_futile
perhaps calling invalidaterect on the listview window would do it?
Posted on 2005-03-21 18:12:45 by evlncrn8
Look into UpdateWindow and RedrawWindow for forcing a redraw.
Posted on 2005-03-21 20:30:05 by tenkey
Thanks man UpdateWindow worked perfect. Just set two timers. One for a window update and the other for the regular LoadValue proc.
Posted on 2005-03-22 00:56:42 by resistance_is_futile