diff --git a/PowerToys.sln b/PowerToys.sln
index 342f8409ad21..5f249ad53897 100644
--- a/PowerToys.sln
+++ b/PowerToys.sln
@@ -641,6 +641,12 @@ Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "AdvancedPaste.FuzzTests", "
EndProject
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "KeyboardManagerEditorUI", "src\modules\keyboardmanager\KeyboardManagerEditorUI\KeyboardManagerEditorUI.csproj", "{08F9155D-B6DC-46E5-9C83-AF60B655898B}"
EndProject
+Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "KeyboardManagerEditorLibraryWrapper", "src\modules\keyboardmanager\KeyboardManagerEditorLibraryWrapper\KeyboardManagerEditorLibraryWrapper.vcxproj", "{1E5AF8BB-8164-4F26-B093-992A287DCA39}"
+EndProject
+Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "KeyboardManagerEditorWrap", "src\modules\keyboardmanager\KeyboardManagerEditorWrap\KeyboardManagerEditorWrap.vcxproj", "{0D4B5BD0-DB9C-4436-9024-B8631A43F632}"
+EndProject
+Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "KeyboardManagerLibraryDLL", "src\modules\keyboardmanager\KeyboardManagerLibraryDLL\KeyboardManagerLibraryDLL.vcxproj", "{C598733E-78A9-4FEC-9787-717879F1A303}"
+EndProject
Global
GlobalSection(SolutionConfigurationPlatforms) = preSolution
Debug|ARM64 = Debug|ARM64
@@ -2855,6 +2861,42 @@ Global
{08F9155D-B6DC-46E5-9C83-AF60B655898B}.Release|x86.ActiveCfg = Release|x86
{08F9155D-B6DC-46E5-9C83-AF60B655898B}.Release|x86.Build.0 = Release|x86
{08F9155D-B6DC-46E5-9C83-AF60B655898B}.Release|x86.Deploy.0 = Release|x86
+ {1E5AF8BB-8164-4F26-B093-992A287DCA39}.Debug|ARM64.ActiveCfg = Debug|ARM64
+ {1E5AF8BB-8164-4F26-B093-992A287DCA39}.Debug|ARM64.Build.0 = Debug|ARM64
+ {1E5AF8BB-8164-4F26-B093-992A287DCA39}.Debug|x64.ActiveCfg = Debug|x64
+ {1E5AF8BB-8164-4F26-B093-992A287DCA39}.Debug|x64.Build.0 = Debug|x64
+ {1E5AF8BB-8164-4F26-B093-992A287DCA39}.Debug|x86.ActiveCfg = Debug|Win32
+ {1E5AF8BB-8164-4F26-B093-992A287DCA39}.Debug|x86.Build.0 = Debug|Win32
+ {1E5AF8BB-8164-4F26-B093-992A287DCA39}.Release|ARM64.ActiveCfg = Release|ARM64
+ {1E5AF8BB-8164-4F26-B093-992A287DCA39}.Release|ARM64.Build.0 = Release|ARM64
+ {1E5AF8BB-8164-4F26-B093-992A287DCA39}.Release|x64.ActiveCfg = Release|x64
+ {1E5AF8BB-8164-4F26-B093-992A287DCA39}.Release|x64.Build.0 = Release|x64
+ {1E5AF8BB-8164-4F26-B093-992A287DCA39}.Release|x86.ActiveCfg = Release|Win32
+ {1E5AF8BB-8164-4F26-B093-992A287DCA39}.Release|x86.Build.0 = Release|Win32
+ {0D4B5BD0-DB9C-4436-9024-B8631A43F632}.Debug|ARM64.ActiveCfg = Debug|x64
+ {0D4B5BD0-DB9C-4436-9024-B8631A43F632}.Debug|ARM64.Build.0 = Debug|x64
+ {0D4B5BD0-DB9C-4436-9024-B8631A43F632}.Debug|x64.ActiveCfg = Debug|x64
+ {0D4B5BD0-DB9C-4436-9024-B8631A43F632}.Debug|x64.Build.0 = Debug|x64
+ {0D4B5BD0-DB9C-4436-9024-B8631A43F632}.Debug|x86.ActiveCfg = Debug|Win32
+ {0D4B5BD0-DB9C-4436-9024-B8631A43F632}.Debug|x86.Build.0 = Debug|Win32
+ {0D4B5BD0-DB9C-4436-9024-B8631A43F632}.Release|ARM64.ActiveCfg = Release|x64
+ {0D4B5BD0-DB9C-4436-9024-B8631A43F632}.Release|ARM64.Build.0 = Release|x64
+ {0D4B5BD0-DB9C-4436-9024-B8631A43F632}.Release|x64.ActiveCfg = Release|x64
+ {0D4B5BD0-DB9C-4436-9024-B8631A43F632}.Release|x64.Build.0 = Release|x64
+ {0D4B5BD0-DB9C-4436-9024-B8631A43F632}.Release|x86.ActiveCfg = Release|Win32
+ {0D4B5BD0-DB9C-4436-9024-B8631A43F632}.Release|x86.Build.0 = Release|Win32
+ {C598733E-78A9-4FEC-9787-717879F1A303}.Debug|ARM64.ActiveCfg = Debug|x64
+ {C598733E-78A9-4FEC-9787-717879F1A303}.Debug|ARM64.Build.0 = Debug|x64
+ {C598733E-78A9-4FEC-9787-717879F1A303}.Debug|x64.ActiveCfg = Debug|x64
+ {C598733E-78A9-4FEC-9787-717879F1A303}.Debug|x64.Build.0 = Debug|x64
+ {C598733E-78A9-4FEC-9787-717879F1A303}.Debug|x86.ActiveCfg = Debug|Win32
+ {C598733E-78A9-4FEC-9787-717879F1A303}.Debug|x86.Build.0 = Debug|Win32
+ {C598733E-78A9-4FEC-9787-717879F1A303}.Release|ARM64.ActiveCfg = Release|x64
+ {C598733E-78A9-4FEC-9787-717879F1A303}.Release|ARM64.Build.0 = Release|x64
+ {C598733E-78A9-4FEC-9787-717879F1A303}.Release|x64.ActiveCfg = Release|x64
+ {C598733E-78A9-4FEC-9787-717879F1A303}.Release|x64.Build.0 = Release|x64
+ {C598733E-78A9-4FEC-9787-717879F1A303}.Release|x86.ActiveCfg = Release|Win32
+ {C598733E-78A9-4FEC-9787-717879F1A303}.Release|x86.Build.0 = Release|Win32
EndGlobalSection
GlobalSection(SolutionProperties) = preSolution
HideSolutionNode = FALSE
@@ -3091,6 +3133,9 @@ Global
{D5E5F5EA-1B6C-4A73-88BE-304F36C9E4EE} = {9873BA05-4C41-4819-9283-CF45D795431B}
{7F5B9557-5878-4438-A721-3E28296BA193} = {9873BA05-4C41-4819-9283-CF45D795431B}
{08F9155D-B6DC-46E5-9C83-AF60B655898B} = {38BDB927-829B-4C65-9CD9-93FB05D66D65}
+ {1E5AF8BB-8164-4F26-B093-992A287DCA39} = {38BDB927-829B-4C65-9CD9-93FB05D66D65}
+ {0D4B5BD0-DB9C-4436-9024-B8631A43F632} = {38BDB927-829B-4C65-9CD9-93FB05D66D65}
+ {C598733E-78A9-4FEC-9787-717879F1A303} = {38BDB927-829B-4C65-9CD9-93FB05D66D65}
EndGlobalSection
GlobalSection(ExtensibilityGlobals) = postSolution
SolutionGuid = {C3A2F9D1-7930-4EF4-A6FC-7EE0A99821D0}
diff --git a/src/modules/keyboardmanager/KeyboardManagerEditorUI/MainWindow.xaml.cs b/src/modules/keyboardmanager/KeyboardManagerEditorUI/MainWindow.xaml.cs
index 48033cf54b61..c1e239094431 100644
--- a/src/modules/keyboardmanager/KeyboardManagerEditorUI/MainWindow.xaml.cs
+++ b/src/modules/keyboardmanager/KeyboardManagerEditorUI/MainWindow.xaml.cs
@@ -6,6 +6,7 @@
using System.Collections.Generic;
using System.IO;
using System.Linq;
+using System.Runtime.InteropServices;
using System.Runtime.InteropServices.WindowsRuntime;
using Microsoft.UI.Xaml;
using Microsoft.UI.Xaml.Controls;
@@ -26,6 +27,12 @@ namespace KeyboardManagerEditorUI
///
public sealed partial class MainWindow : Window
{
+ // [DllImport("KeyboardManagerLibraryDLL.dll", CallingConvention = CallingConvention.Cdecl)]
+ // private static extern int Add();
+ // [LibraryImport("KeyboardManagerLibraryDLL.dll", StringMarshalling = StringMarshalling.Utf16, SetLastError = true)]
+ [DllImport("KeyboardManagerLibraryDLL.dll", CallingConvention = CallingConvention.Cdecl)]
+ private static extern int Add();
+
public MainWindow()
{
this.InitializeComponent();
@@ -33,7 +40,9 @@ public MainWindow()
private void MyButton_Click(object sender, RoutedEventArgs e)
{
- myButton.Content = "Clicked";
+ // Call the C++ function to display it in the button content
+ int result = Add();
+ myButton.Content = result;
}
}
}
diff --git a/src/modules/keyboardmanager/KeyboardManagerLibraryDLL/KeyboardManagerLibraryDLL.vcxproj b/src/modules/keyboardmanager/KeyboardManagerLibraryDLL/KeyboardManagerLibraryDLL.vcxproj
new file mode 100644
index 000000000000..d4f7cac137ab
--- /dev/null
+++ b/src/modules/keyboardmanager/KeyboardManagerLibraryDLL/KeyboardManagerLibraryDLL.vcxproj
@@ -0,0 +1,180 @@
+
+
+
+
+
+ Debug
+ Win32
+
+
+ Release
+ Win32
+
+
+ Debug
+ x64
+
+
+ Release
+ x64
+
+
+
+ 17.0
+ Win32Proj
+ {c598733e-78a9-4fec-9787-717879f1a303}
+ KeyboardManagerLibraryDLL
+ 10.0
+
+
+
+ DynamicLibrary
+ true
+ v143
+ Unicode
+
+
+ DynamicLibrary
+ false
+ v143
+ true
+ Unicode
+
+
+ DynamicLibrary
+ false
+ v143
+ NotSet
+
+
+ DynamicLibrary
+ false
+ v143
+ true
+ Unicode
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+ true
+
+
+
+ Level3
+ true
+ WIN32;_DEBUG;KEYBOARDMANAGERLIBRARYDLL_EXPORTS;_WINDOWS;_USRDLL;%(PreprocessorDefinitions)
+ true
+ Use
+
+
+ Windows
+ true
+ false
+
+
+
+
+ Level3
+ true
+ true
+ true
+ WIN32;NDEBUG;KEYBOARDMANAGERLIBRARYDLL_EXPORTS;_WINDOWS;_USRDLL;%(PreprocessorDefinitions)
+ true
+ Use
+
+
+ Windows
+ true
+ true
+ true
+ false
+
+
+
+
+ Level3
+ true
+ _DEBUG;KEYBOARDMANAGERLIBRARYDLL_EXPORTS;_WINDOWS;_USRDLL;%(PreprocessorDefinitions)
+ false
+ Use
+ ./;$(SolutionDir)src\modules\;$(SolutionDir)src\common\Display;$(SolutionDir)src\common\inc;$(SolutionDir)src\common\Telemetry;$(SolutionDir)src;%(AdditionalIncludeDirectories)
+ false
+
+
+ Windows
+ true
+ false
+
+
+
+
+ Level3
+ true
+ true
+ true
+ NDEBUG;KEYBOARDMANAGERLIBRARYDLL_EXPORTS;_WINDOWS;_USRDLL;%(PreprocessorDefinitions)
+ true
+ Use
+
+
+ Windows
+ true
+ true
+ true
+ false
+
+
+
+
+
+
+
+
+
+
+ Create
+ Create
+ Create
+ Create
+
+
+
+
+
+ {8affa899-0b73-49ec-8c50-0fadda57b2fc}
+
+
+ {23d2070d-e4ad-4add-85a7-083d9c76ad49}
+
+
+
+
+
+
+
+
+
+
+
+ This project references NuGet package(s) that are missing on this computer. Use NuGet Package Restore to download them. For more information, see http://go.microsoft.com/fwlink/?LinkID=322105. The missing file is {0}.
+
+
+
+
+
\ No newline at end of file
diff --git a/src/modules/keyboardmanager/KeyboardManagerLibraryDLL/KeyboardManagerLibraryDLL.vcxproj.filters b/src/modules/keyboardmanager/KeyboardManagerLibraryDLL/KeyboardManagerLibraryDLL.vcxproj.filters
new file mode 100644
index 000000000000..f4d44c1cc30a
--- /dev/null
+++ b/src/modules/keyboardmanager/KeyboardManagerLibraryDLL/KeyboardManagerLibraryDLL.vcxproj.filters
@@ -0,0 +1,42 @@
+
+
+
+
+ {4FC737F1-C7A5-4376-A066-2A32D752A2FF}
+ cpp;c;cc;cxx;c++;cppm;ixx;def;odl;idl;hpj;bat;asm;asmx
+
+
+ {93995380-89BD-4b04-88EB-625FBE52EBFB}
+ h;hh;hpp;hxx;h++;hm;inl;inc;ipp;xsd
+
+
+ {67DA6AB6-F800-4c08-8B7A-83BB121AAD01}
+ rc;ico;cur;bmp;dlg;rc2;rct;bin;rgs;gif;jpg;jpeg;jpe;resx;tiff;tif;png;wav;mfcribbon-ms
+
+
+
+
+ Header Files
+
+
+ Header Files
+
+
+ Header Files
+
+
+
+
+ Source Files
+
+
+ Source Files
+
+
+ Source Files
+
+
+
+
+
+
\ No newline at end of file
diff --git a/src/modules/keyboardmanager/KeyboardManagerLibraryDLL/cpplib.cpp b/src/modules/keyboardmanager/KeyboardManagerLibraryDLL/cpplib.cpp
new file mode 100644
index 000000000000..edc38da9e73c
--- /dev/null
+++ b/src/modules/keyboardmanager/KeyboardManagerLibraryDLL/cpplib.cpp
@@ -0,0 +1,24 @@
+#include "pch.h"
+#include "cpplib.h"
+
+int Add()
+{
+ RemapBuffer remapBuffer;
+
+ // Remap A to B and B to C
+ remapBuffer.push_back(RemapBufferRow{ RemapBufferItem({ (DWORD)0x41, (DWORD)0x42 }), std::wstring() });
+ //remapBuffer.push_back(RemapBufferRow{ RemapBufferItem({ (DWORD)0x42, (DWORD)0x43 }), std::wstring() });
+ remapBuffer.push_back(RemapBufferRow{ RemapBufferItem({ (DWORD)0x41, (DWORD)0 }), std::wstring() });
+
+ auto result = LoadingAndSavingRemappingHelper::CheckIfRemappingsAreValid(remapBuffer);
+ // print the result of LoadingAndSavingRemappingHelper::CheckIfRemappingsAreValid(remapBuffer) to the console
+ // std::cout << "CheckIfRemappingsAreValid(remapBuffer) = " << static_cast(result) << std::endl;
+
+ // return the result of LoadingAndSavingRemappingHelper::CheckIfRemappingsAreValid(remapBuffer) which is a enum as a string
+ if (result == ShortcutErrorType::NoError)
+ {
+ return 123;
+ }
+
+ return 456;
+}
\ No newline at end of file
diff --git a/src/modules/keyboardmanager/KeyboardManagerLibraryDLL/cpplib.h b/src/modules/keyboardmanager/KeyboardManagerLibraryDLL/cpplib.h
new file mode 100644
index 000000000000..f62ed88fb682
--- /dev/null
+++ b/src/modules/keyboardmanager/KeyboardManagerLibraryDLL/cpplib.h
@@ -0,0 +1,5 @@
+#pragma once
+
+#include
+
+extern "C" __declspec(dllexport) int Add();
diff --git a/src/modules/keyboardmanager/KeyboardManagerLibraryDLL/dllmain.cpp b/src/modules/keyboardmanager/KeyboardManagerLibraryDLL/dllmain.cpp
new file mode 100644
index 000000000000..f2665971ac86
--- /dev/null
+++ b/src/modules/keyboardmanager/KeyboardManagerLibraryDLL/dllmain.cpp
@@ -0,0 +1,19 @@
+// dllmain.cpp : Defines the entry point for the DLL application.
+#include "pch.h"
+
+BOOL APIENTRY DllMain( HMODULE hModule,
+ DWORD ul_reason_for_call,
+ LPVOID lpReserved
+ )
+{
+ switch (ul_reason_for_call)
+ {
+ case DLL_PROCESS_ATTACH:
+ case DLL_THREAD_ATTACH:
+ case DLL_THREAD_DETACH:
+ case DLL_PROCESS_DETACH:
+ break;
+ }
+ return TRUE;
+}
+
diff --git a/src/modules/keyboardmanager/KeyboardManagerLibraryDLL/framework.h b/src/modules/keyboardmanager/KeyboardManagerLibraryDLL/framework.h
new file mode 100644
index 000000000000..54b83e94fd33
--- /dev/null
+++ b/src/modules/keyboardmanager/KeyboardManagerLibraryDLL/framework.h
@@ -0,0 +1,5 @@
+#pragma once
+
+#define WIN32_LEAN_AND_MEAN // Exclude rarely-used stuff from Windows headers
+// Windows Header Files
+#include
diff --git a/src/modules/keyboardmanager/KeyboardManagerLibraryDLL/packages.config b/src/modules/keyboardmanager/KeyboardManagerLibraryDLL/packages.config
new file mode 100644
index 000000000000..09bfc449e21c
--- /dev/null
+++ b/src/modules/keyboardmanager/KeyboardManagerLibraryDLL/packages.config
@@ -0,0 +1,4 @@
+
+
+
+
\ No newline at end of file
diff --git a/src/modules/keyboardmanager/KeyboardManagerLibraryDLL/pch.cpp b/src/modules/keyboardmanager/KeyboardManagerLibraryDLL/pch.cpp
new file mode 100644
index 000000000000..64b7eef6d6b9
--- /dev/null
+++ b/src/modules/keyboardmanager/KeyboardManagerLibraryDLL/pch.cpp
@@ -0,0 +1,5 @@
+// pch.cpp: source file corresponding to the pre-compiled header
+
+#include "pch.h"
+
+// When you are using pre-compiled headers, this source file is necessary for compilation to succeed.
diff --git a/src/modules/keyboardmanager/KeyboardManagerLibraryDLL/pch.h b/src/modules/keyboardmanager/KeyboardManagerLibraryDLL/pch.h
new file mode 100644
index 000000000000..968d3f1a6411
--- /dev/null
+++ b/src/modules/keyboardmanager/KeyboardManagerLibraryDLL/pch.h
@@ -0,0 +1,20 @@
+// pch.h: This is a precompiled header file.
+// Files listed below are compiled only once, improving build performance for future builds.
+// This also affects IntelliSense performance, including code completion and many code browsing features.
+// However, files listed here are ALL re-compiled if any one of them is updated between builds.
+// Do not add files here that you will be updating frequently as this negates the performance advantage.
+
+#ifndef PCH_H
+#define PCH_H
+
+// add headers that you want to pre-compile here
+#include "framework.h"
+#include
+#include
+#include
+#include
+#include
+#include "../KeyboardManagerEditorLibrary/LoadingAndSavingRemappingHelper.h"
+#include "../common/Shortcut.h"
+
+#endif //PCH_H