diff options
Diffstat (limited to 'wrapper')
| -rw-r--r-- | wrapper/wrapper.cpp | 27 | ||||
| -rw-r--r-- | wrapper/wrapper.vcxproj | 4 |
2 files changed, 26 insertions, 5 deletions
diff --git a/wrapper/wrapper.cpp b/wrapper/wrapper.cpp index 7e3f736..2c0d5e3 100644 --- a/wrapper/wrapper.cpp +++ b/wrapper/wrapper.cpp @@ -1,13 +1,16 @@ #pragma once #include <type_traits> +#include <msclr\marshal_cppstd.h> #include <rawaccel.hpp> #include <rawaccel-version.h> +#include <utility-rawinput.hpp> #include "wrapper_io.hpp" using namespace System; +using namespace System::Collections::Generic; using namespace System::Runtime::InteropServices; using namespace System::Reflection; @@ -78,9 +81,9 @@ public ref struct DriverSettings [JsonProperty(Required = Required::Default)] double minimumTime; - [JsonProperty("Device Hardware ID", Required = Required::Default)] - [MarshalAs(UnmanagedType::ByValTStr, SizeConst = MAX_HWID_LEN)] - String^ deviceHardwareID; + [JsonProperty("Device ID", Required = Required::Default)] + [MarshalAs(UnmanagedType::ByValTStr, SizeConst = MAX_DEV_ID_LEN)] + String^ deviceID = ""; bool ShouldSerializeminimumTime() { @@ -221,6 +224,24 @@ public: } }; +public ref struct RawInputInterop +{ + static void AddHandlesFromID(String^ deviceID, List<IntPtr>^ rawInputHandles) + { + try + { + std::vector<HANDLE> nativeHandles = rawinput_handles_from_dev_id( + msclr::interop::marshal_as<std::wstring>(deviceID)); + + for (auto nh : nativeHandles) rawInputHandles->Add(IntPtr(nh)); + } + catch (const std::exception& e) + { + throw gcnew System::Exception(gcnew String(e.what())); + } + } +}; + public ref struct DriverInterop { literal double WriteDelayMs = WRITE_DELAY; diff --git a/wrapper/wrapper.vcxproj b/wrapper/wrapper.vcxproj index 4f8ed1c..721a981 100644 --- a/wrapper/wrapper.vcxproj +++ b/wrapper/wrapper.vcxproj @@ -59,7 +59,7 @@ <LanguageStandard>stdcpp17</LanguageStandard> </ClCompile> <Link> - <AdditionalDependencies /> + <AdditionalDependencies>User32.lib;</AdditionalDependencies> </Link> <ResourceCompile> <AdditionalIncludeDirectories>$(SolutionDir)/common;</AdditionalIncludeDirectories> @@ -72,7 +72,7 @@ <LanguageStandard>stdcpp17</LanguageStandard> </ClCompile> <Link> - <AdditionalDependencies /> + <AdditionalDependencies>User32.lib;</AdditionalDependencies> </Link> <PostBuildEvent> <Command>copy /Y "$(TargetPath)" "$(SolutionDir)signed\$(TargetFileName)" & |