 |
Cheat Engine The Official Site of Cheat Engine
|
| View previous topic :: View next topic |
| Author |
Message |
Kuwaga Newbie cheater
Reputation: 0
Joined: 21 Apr 2012 Posts: 11
|
Posted: Tue May 06, 2014 9:38 pm Post subject: Drag and Drop for ListView |
|
|
I can't quite seem to get it to work.
I want a simple Drag and Drop that lets me reorder the rows in a ListView. Events like OnMouseUp seem very useful for that. I can calculate the index of the row (aka ListItem) the mouse button was released on from its y coordinate. However, there is a problem when the ListView gets a vertical scrollbar. Maybe it's just me, but I've failed to find a way to check the status of that scrollbar. Without that, I can't think of a way to get the correct index.
I have managed to find a value by running a memory scan on CheatEngine itself that's always the index of the topmost visible row (meaning if you scroll all the way up to the top, it's 0, if you scroll down enough so that the two topmost rows vanish, it will be 2). But I haven't found a way to access that value through the Lua interface yet. I suppose I could read CheatEngine's memory from within the Lua script to receive it, but that sounds like a pretty bad idea to me.
Maybe I am missing something really obvious here. I feel embarrassed that I couldn't solve the issue by myself in a satisfactory manner.
|
|
| Back to top |
|
 |
Kuwaga Newbie cheater
Reputation: 0
Joined: 21 Apr 2012 Posts: 11
|
Posted: Fri May 09, 2014 3:41 pm Post subject: |
|
|
Since I got no reply yet, I've invested some more time into trying to solve it myself. I ended up with this auto assembler script.
| Code: | alloc(scrollmod,2048,"comctl32.dll"+37D76)
registersymbol(scrollmod)
label(returnhere)
label(originalcode)
label(exit)
scrollmod: //this is allocated memory, you have read,write,execute access
//place your code here
mov ["scrollmod"+20],eax
originalcode:
mov [r11+0C],eax
mov r9d,esi
exit:
jmp returnhere
"comctl32.dll"+37D76:
jmp scrollmod
nop
nop
returnhere: |
It seemed to work, and the value could then be read from "scrollmod"+20. However, the problem then is, which I hadn't noticed before, that this value will be set for the last vertical scrollbar used across all CheatEngine windows. So this solution is no good either, unfortunately.
I might just give up at this point. Or I'd need to find a way to find out, in that injected function, what the currently active form is. That sounds like quite a task though.
Maybe I could think of an alternate solution, though I should probably just give up at this point. It wouldn't really be worth the time, would it?
Edit: I had an idea! I could monitor OnActivate and OnDeactivate for the form I want to add Drag and Drop functionality for. While it's active, I'd enable a timer. And that timer event would periodically read from "scrollmod"+20. So that should give me a value that always knows the current scrollbar position. What's even better, this should work with multiple active forms at once as well.
I guess what's still left to do is an aob scan then, to make sure the function is always injected in the correct spot, right? So that it would work on other machines as well? Or is that not guaranteed even with an aob scan?
Edit again:
Nah, I'm an idiot. That doesn't solve anything, as the value for that scroll bar gets only written when it changes, so even if I activate the form, "scrollmod"+20 would still be the value it got from scrolling the last scrollbar across all windows...
Though if I keep reading from "scrollmod"+20 with that timer, as I explained, and then only update the form-wide value if it changes from one read to the next one, that should do it... Right?
Sorry for all of this spam.
|
|
| Back to top |
|
 |
|
|
You cannot post new topics in this forum You cannot reply to topics in this forum You cannot edit your posts in this forum You cannot delete your posts in this forum You cannot vote in polls in this forum You cannot attach files in this forum You can download files in this forum
|
|