© 2026 Hedgehog Software, LLC

TwitterGitHubDiscord
More
CommunitiesDocsAboutTermsPrivacy
Search
Star
Setup for Free
C#C
C#•7mo ago•
7 replies
Phill

PInvoke.GetRawInputData returns -1

uint output = PInvoke.GetRawInputData(
    (Windows.Win32.UI.Input.HRAWINPUT)m.LParam,
    Windows.Win32.UI.Input.RAW_INPUT_DATA_COMMAND_FLAGS.RID_INPUT,
    null,
    ref dwSize,
    (uint)sizeof(Windows.Win32.UI.Input.HRAWINPUT));
Debug.WriteLine("output " +  (int)output);
uint output = PInvoke.GetRawInputData(
    (Windows.Win32.UI.Input.HRAWINPUT)m.LParam,
    Windows.Win32.UI.Input.RAW_INPUT_DATA_COMMAND_FLAGS.RID_INPUT,
    null,
    ref dwSize,
    (uint)sizeof(Windows.Win32.UI.Input.HRAWINPUT));
Debug.WriteLine("output " +  (int)output);

this returns -1 and dwSize is never set. It's not working and I don't know why.
https://github.com/PhillBenoit/KeyboardGame
GitHub
GitHub - PhillBenoit/KeyboardGame: 4 player word game
4 player word game. Contribute to PhillBenoit/KeyboardGame development by creating an account on GitHub.
GitHub - PhillBenoit/KeyboardGame: 4 player word game
C# banner
C#Join
We are a programming server aimed at coders discussing everything related to C# (CSharp) and .NET.
61,871Members
Resources

Similar Threads

Was this page helpful?
Recent Announcements

Similar Threads

Crossplatform VarArg PInvoke
C#CC# / help
2y ago
Interoperability issues (PInvoke)
C#CC# / help
4y ago
✅ CsWin32 not generating PInvoke for GetThreadContext
C#CC# / help
9mo ago
PInvoke access violation, even signature is corret.
C#CC# / help
2y ago