If this is your first visit, be sure to
check out the FAQ by clicking the
link above. You may have to register or Login
before you can post: click the register link above to proceed. To start viewing messages,
select the forum that you want to visit from the selection below.

Re: ListView_GetItemRect Help

The macro still returns FALSE.
1.Can you please let me know what would be the possible mistakes I would have done.
2.Is there any macro to click an item in listview or can you help/guide me regarding this.

Re: ListView_GetItemRect Help

Sir I am developing an automation tool for which I need to click on the item in the listview. As there is no macro for directly clicking on listview item.One of my colleague suggested me, " to get the listview item size using ListView_GetItemRect and then try to convert it to X,Y mouse point and click on it".But I am completely blank. Please help me and sorry for disturbing you a lot sir.

Re: ListView_GetItemRect Help

I am new to Windows programming and I am trying to click an item in listview control for that I need to take the rect size of the listview.Can anyone help me regarding ListView_GetItemRect macro.

Your problem is not the macro. Your problem is that you hardly understand how Windows controls work. You're looking for some magic macro while there is no one in your specific case.

Originally Posted by haroonrulz

Sir I am developing an automation tool for which I need to click on the item in the listview. As there is no macro for directly clicking on listview item.One of my colleague suggested me, " to get the listview item size using ListView_GetItemRect and then try to convert it to X,Y mouse point and click on it".But I am completely blank.

So you're not prepared enough for completing this task. You cannot develop anything complex in Windows being completely blank and new to Windows programming.

Now to your assignment.

It may be solved two different ways. First is code injection. This (writing code to remote process and creating remote thread) or that (injecting dll) way your code have to appear in the context of the process you to automate. Then by means of some IPC (inter-process communication) your code gets the command 'click on item 3', gets the corresponding item rect (by means of the macro, or sending LVM_GETITEMRECT, whatever), positions mouse cursor inside the rect, emulates left button down and button up events. I repeat: All this code is inside the victim process.

Second way implies no code injection, but ability to read/write the victim process memory is mandatory anyway. The automation process allocates remote memory enough to fit RECT in and passes the remote address to the macro, then it reads the rect coordinates and emulates the mouse button click as explained above. And does not forget to deallocate later, of course.

This is how it looks from "helicopter view". A special headache is acquiring rights enough to read/write remote process memory or inject dll, as since Vista times Microsoft decided to make this kind of tricks be much more tricky than it was before.

Now can anybody explain me how this could be done by somebody who's completely blank and new to Windows programming? Guys, if you really need some automation engine, you'd better go with already proved solutions like AutoIt