Solved send key dinput8

Hexui Undetected CSGO Cheats Sinkicheat PUBG Cheat

mrparo

Newbie
Full Member
Oct 17, 2012
10
262
0
Im trying to send a mouse click to driect input

SendInput & mouse_event
just freezes the mouse and don't click the mouse
so they dont work.

PostMessage
don't do anything

I have hooked GetDeviceData
as that function is called in the game.

i can stop mouse clicks with it but am unable to send a mouse click
this is how im trying to send mouse click
C++:
HRESULT WINAPI hkGetDeviceData(LPDIRECTINPUTDEVICE pInputDevice, DWORD cbObjectData, LPDIDEVICEOBJECTDATA rgdod, LPDWORD pdwInOut, DWORD dwFlags)
{
	HRESULT Result = oGetDeviceData(pInputDevice, cbObjectData, rgdod, pdwInOut, dwFlags);

	rgdod->dwOfs = DIMOFS_BUTTON0;
	rgdod->dwData = 0x80;

    return Result; 
}
what am i doing wrong?
Thanks
 

AlexSleyore

Coder
Full Member
Nobleman
Oct 29, 2012
100
613
1
My Best guess
C++:
HRESULT WINAPI hkGetDeviceData(LPDIRECTINPUTDEVICE pInputDevice, DWORD cbObjectData, LPDIDEVICEOBJECTDATA rgdod, LPDWORD pdwInOut, DWORD dwFlags)
{

DIDEVICEOBJECTDATA Buffer[50]; //50 is just a large random number, I dont feel like setting up a dynamic array for a simple example
long TotalItems;
TotalItems = *(long*)pdwInOut;

for(int Item = 0; Item < TotalItems; Item++)
{
Buffer[Item] = *(DIDEVICEOBJECTDATA*)  (rgdod+(Item*cbObjectData));
if(Buffer[Item].dwOfs ==DIMOFS_BUTTON0)
{
MessageBoxA(NULL,"Mouse Was Clicked", "The Mouse has been clicked", MB_OK);
} 

}
    return oGetDeviceData(pInputDevice, cbObjectData, rgdod, pdwInOut, dwFlags);
}

try that out, it should give you a messagebox when you click you mouse, ive never worked with that function and the code untested but I think its right.
 
  • Like
Reactions: mrparo

mrparo

Newbie
Full Member
Oct 17, 2012
10
262
0
hey thanks for the reply.
but the problem is i cant send a mouse click
i know how to detect if i have clicked the mouse kinda like you posted there.
i think it has something to do with the way its getting polled
 

AlexSleyore

Coder
Full Member
Nobleman
Oct 29, 2012
100
613
1
I was actually asking if that DID work, because if it did - I know how you would write a mouse click into the array without losing any of the data.
 

mrparo

Newbie
Full Member
Oct 17, 2012
10
262
0
hey mate that dose work when i click the mouse.
But the problem is that once i have clicked the mouse once the message box will keep coming up
 

AlexSleyore

Coder
Full Member
Nobleman
Oct 29, 2012
100
613
1
"The high bit of the low byte is set if the button was pressed; it is clear if the button was released." wanna be any more useless MSDN -.- ... sooo.... Test this, if the number changes when the mouse is release.. makes it

If(Buffer[Item].dwOfs ==DIMOFS_BUTTON0 && Buffer[Item].dwData == VALUE_WHEN_MOUSE_IS_DOWN)

If this works, then Ill see about trying to get it to accept your mouse clicks. There is a chance though even if it does work - that this isnt the function the game uses to determine of you have clicked the mouse or not.


C++:
HRESULT WINAPI hkGetDeviceData(LPDIRECTINPUTDEVICE pInputDevice, DWORD cbObjectData, LPDIDEVICEOBJECTDATA rgdod, LPDWORD pdwInOut, DWORD dwFlags)
{

DIDEVICEOBJECTDATA Buffer[50]; //50 is just a large random number, I dont feel like setting up a dynamic array for a simple example
long TotalItems;
TotalItems = *(long*)pdwInOut;

for(int Item = 0; Item < TotalItems; Item++)
{
Buffer[Item] = *(DIDEVICEOBJECTDATA*)  (rgdod+(Item*cbObjectData));
if(Buffer[Item].dwOfs ==DIMOFS_BUTTON0)
{
char TextBuffer[50];
sprintF(&TextBuffer, "Does this Num change when you click the mouse?  %d",Buffer[Item].dwData);
MessageBoxA(NULL,TextBuffer, "Debug Crap", MB_OK);
} 

}
    return oGetDeviceData(pInputDevice, cbObjectData, rgdod, pdwInOut, dwFlags);
}
 
  • Like
Reactions: mrparo

mrparo

Newbie
Full Member
Oct 17, 2012
10
262
0
number says 128 when i click.
but the message box keeps coming up after i click

edit:
the message box will go away after i minimize the game (game is set windowed mode)
then get back into it then click ok on message box.

then when i click in game again with mouse the message box shows like it should with a mouse click

number is when mouse clicked
0 when mouse button released
 
Last edited:
Attention! Before you post:

Read the How to Ask Questions Guide
99% of questions are answered in the Beginner's Guide, do it before asking a question.

No Hack Requests. Post in the correct section.  Search the forum first. Read the rules.

How to make a good post:

  • Fill out the form correctly
  • Tell us the game name & coding language
  • Post everything we need to know to help you
  • Ask specific questions, be descriptive
  • Post errors, line numbers & screenshots
  • Post code snippets using code tags
  • If it's a large project, zip it up and attach it

If you do not comply, your post may be deleted.  We want to help, please make a good post and we will do our best to help you.

Community Mods