From: Boris Pauljev on
Does anybody know how I can change a bit in a low level hook?

'lParam points to the low-level mouse data, copy it to dat
dat = hkMs.xMSLLHOOKSTRUCT(lParam)

Dim bMInjected As Boolean
bMInjected = CBool(dat.flags And LLMHF_INJECTED)

Using this code I can check if the mouse data was simulated by a program
or if it was a real user input, but I also need to change it. I need to
steer a game but it checks this bit and doesn't allow my input.

Thanks a lot!
From: MikeD on


"Boris Pauljev" <nordiccoder(a)hotmail.com> wrote in message
news:OtA6tt94KHA.4888(a)TK2MSFTNGP06.phx.gbl...
> Does anybody know how I can change a bit in a low level hook?
>
> 'lParam points to the low-level mouse data, copy it to dat
> dat = hkMs.xMSLLHOOKSTRUCT(lParam)
>
> Dim bMInjected As Boolean
> bMInjected = CBool(dat.flags And LLMHF_INJECTED)
>
> Using this code I can check if the mouse data was simulated by a program
> or if it was a real user input, but I also need to change it. I need to
> steer a game but it checks this bit and doesn't allow my input.
>


Change it how? Do you want to remove the LLMHF_INJECTED flag?

dat.flags = dat.flags And Not LLMHF_INJECTED

To re-add that flag:

dat.flags = dat.flags Or LLMHF_INJECTED

Or are you wanting to shift bits?

Public Function ShiftLeft(ByVal InitNum As Long, ByVal BitsLeft As Long) As
Long

'Performs a bitwise left-shift. This is equivalent to C++'s <<
operator.

'C++:
' 1024 << 8 //Shift left 8 bits

'VB:
' ShiftLeft(1024, 8) 'Shift left 8 bits


ShiftLeft = CLng(InitNum * (2 ^ BitsLeft))

End Function

Public Function ShiftRight(ByVal InitNum As Long, ByVal BitsRight As Long)
As Long

'Performs a bitwise right-shift. This is equivalent to C++'s >>
operator.


ShiftRight = CLng(InitNum / (2 ^ BitsRight))

End Function

Or are you wanting to do something else such as set specific bits?

--
Mike


From: Boris Pauljev on
That's fine thanks!
 | 
Pages: 1
Prev: Microphone Vista
Next: Scrollbar Repeats