Mouse "Delta" via PostMessage

Get help with using AutoHotkey (v1.1 and older) and its commands and hotkeys
User avatar
masheen
Posts: 295
Joined: 06 Dec 2016, 14:10

Mouse "Delta" via PostMessage

18 Nov 2017, 19:06

I think this question nobody knows the answer, but I will ask anyway
look at the image. It is spy++

Image

selected row (blue) is mousemove. For mouse move i get lParam := x&0xFFFF | y<<16
like this

Code: Select all

MouseMoves(x, y, title){
	lParam := x&0xFFFF | y<<16 ; <-----------------------
	PostMessage, 0x0200, 0x0000, % lParam,, % title	
	return
}
What is it RIM_INPUT (inside the red box on image) and how to get lParam for this? I know for my situation it is mousemove too
First is WM_MOUSEMOVE, then is WM_INPUT, but its all about movement mouse.

Question:
Anybody know how to get lParam for this WM_INPUT?
_____________________
Sorry for my English
Last edited by masheen on 21 Nov 2017, 06:07, edited 3 times in total.
User avatar
KuroiLight
Posts: 327
Joined: 12 Apr 2015, 20:24
Contact:

Re: PostMessage lParam

18 Nov 2017, 19:21

RIM_INPUT = 0 which states that "Input occurred while the application was in the foreground."
found on WM_INPUT
Windows 10, Ryzen 1600, 16GB G.Skill DDR4, 8GB RX 480 | [MyScripts][MySublimeSettings] [Unlicense][MIT License]
01/24/18
[/color]
User avatar
masheen
Posts: 295
Joined: 06 Dec 2016, 14:10

Re: PostMessage lParam

18 Nov 2017, 20:43

Figure it, what is it WM_INPUT in my situation, this application likely doing is reading "Delta" information from the mouse.

New question:
Can i to simulate this delta using PostMessage?
User avatar
KuroiLight
Posts: 327
Joined: 12 Apr 2015, 20:24
Contact:

Re: PostMessage lParam

18 Nov 2017, 21:11

Do you mean mouse wheel delta?. Is this a program sending mouse data to another window or is this an event captured from the user?
If you are trying to simulate a mouse event, outside of the builtin functions there is also mouse_event, but i believe SendEvent does the same thing.
If you want to get raw input from a device take a look at GetRawInputData and RAWMOUSE.
Windows 10, Ryzen 1600, 16GB G.Skill DDR4, 8GB RX 480 | [MyScripts][MySublimeSettings] [Unlicense][MIT License]
01/24/18
[/color]
User avatar
masheen
Posts: 295
Joined: 06 Dec 2016, 14:10

Re: PostMessage lParam

19 Nov 2017, 00:38

KuroiLight wrote:Do you mean mouse wheel delta?. Is this a program sending mouse data to another window or is this an event captured from the user?
If you are trying to simulate a mouse event, outside of the builtin functions there is also mouse_event, but i believe SendEvent does the same thing.
If you want to get raw input from a device take a look at GetRawInputData and RAWMOUSE.
Not wheel delta.

Code: Select all

MouseGetPos and other methods of retrieving mouse axis input are fundamentally flawed when it comes to games, because many games mess with the mouse cursor (Keep on moving it to middle of screen etc) or other limitations (eg when the cursor reaches the edge of the screen, you cannot generate any more input in that direction)

Games that do not operate by mouse cursor (eg FPS) generally read the mouse by "Delta" information - that is, the amount that it moved in each direction since the last update.

This library uses the RawInput API to read these Delta Move packets.
i think this post more match:
https://autohotkey.com/boards/viewtopic.php?t=10159
or
https://autohotkey.com/boards/viewtopic ... 97#p151897

but now i have new question, can i simulate "MouseDelta" via PostMessage?
User avatar
KuroiLight
Posts: 327
Joined: 12 Apr 2015, 20:24
Contact:

Re: PostMessage lParam

19 Nov 2017, 12:09

Oh now I understand, I'm pretty sure the answer is no.
My only suggestion is to try via MouseMove with SendMode set to SendInput or use the library you linked to get mousedelta values and then try sending them via sendmessage wm_input; otherwise you would need to write a Human Interface Device (HID) driver to simulate raw mouse input.
Windows 10, Ryzen 1600, 16GB G.Skill DDR4, 8GB RX 480 | [MyScripts][MySublimeSettings] [Unlicense][MIT License]
01/24/18
[/color]
User avatar
masheen
Posts: 295
Joined: 06 Dec 2016, 14:10

Re: PostMessage lParam

21 Nov 2017, 02:16

KuroiLight wrote:Oh now I understand, I'm pretty sure the answer is no.
My only suggestion is to try via MouseMove with SendMode set to SendInput or use the library you linked to get mousedelta values and then try sending them via sendmessage wm_input; otherwise you would need to write a Human Interface Device (HID) driver to simulate raw mouse input.
Why not? Spy++ show to me that window get "delta" from my mouse? I think i can send it to window too or not?
Image

___
Sorry for my english.
User avatar
KuroiLight
Posts: 327
Joined: 12 Apr 2015, 20:24
Contact:

Re: Mouse "Delta" via PostMessage

21 Nov 2017, 16:15

The reason being is that it depends on whether the application your sending it to will actually accept the message or not, if its a game we're talking about here you could be seeing these wm_input messages as a side-effect and the game is actually just reading from raw input. (I could be wrong)
Like I said, the only way to know if it works is to try it; build raw_input struct and send the wm_input message via sendmessage.
this post might shed some light on how to do that: https://autohotkey.com/board/topic/2128 ... ntry140478
or use the code from that library you linked: https://autohotkey.com/boards/viewtopic.php?t=10159
Or just use mouse_event which as far as I know generates a WM_INPUT event.. which generates a WM_MOUSEMOVE event
Windows 10, Ryzen 1600, 16GB G.Skill DDR4, 8GB RX 480 | [MyScripts][MySublimeSettings] [Unlicense][MIT License]
01/24/18
[/color]

Return to “Ask for Help (v1)”

Who is online

Users browsing this forum: Rohwedder and 111 guests