返回提交历史
Added
XFE各类拓展.NetCore.InputSimulator.sln
+25
-0
Added
XFE各类拓展.NetCore.InputSimulator/InputSimulator.cs
+30
-0
Added
XFE各类拓展.NetCore.InputSimulator/XFE各类拓展.NetCore.InputSimulator.csproj
+9
-0
XFEstudio/XFEExtension.NetCore.InputSimulator
添加项目文件。
d5e1ad1
代码差异
3 个文件
+64
-0
@@ -0,0 +1,25 @@
1
2
Microsoft Visual Studio Solution File, Format Version 12.00
3
# Visual Studio Version 17
4
VisualStudioVersion = 17.8.34330.188
5
MinimumVisualStudioVersion = 10.0.40219.1
6
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "XFE各类拓展.NetCore.InputSimulator", "XFE各类拓展.NetCore.InputSimulator\XFE各类拓展.NetCore.InputSimulator.csproj", "{A7146E68-D79B-4EB5-B334-8414656E096E}"
7
EndProject
8
Global
9
GlobalSection(SolutionConfigurationPlatforms) = preSolution
10
Debug|Any CPU = Debug|Any CPU
11
Release|Any CPU = Release|Any CPU
12
EndGlobalSection
13
GlobalSection(ProjectConfigurationPlatforms) = postSolution
14
{A7146E68-D79B-4EB5-B334-8414656E096E}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
15
{A7146E68-D79B-4EB5-B334-8414656E096E}.Debug|Any CPU.Build.0 = Debug|Any CPU
16
{A7146E68-D79B-4EB5-B334-8414656E096E}.Release|Any CPU.ActiveCfg = Release|Any CPU
17
{A7146E68-D79B-4EB5-B334-8414656E096E}.Release|Any CPU.Build.0 = Release|Any CPU
18
EndGlobalSection
19
GlobalSection(SolutionProperties) = preSolution
20
HideSolutionNode = FALSE
21
EndGlobalSection
22
GlobalSection(ExtensibilityGlobals) = postSolution
23
SolutionGuid = {0B26759B-4DC9-49F7-ABB0-5DCC68589657}
24
EndGlobalSection
25
EndGlobal
@@ -0,0 +1,30 @@
1
using System.Runtime.InteropServices;
2
3
namespace XFE各类拓展.NetCore.InputSimulator;
4
5
public static class InputSimulator
6
{
7
#region DLL引用
8
[DllImport("user32.dll", SetLastError = true)]
9
public static extern void keybd_event(byte bVk, byte bScan, uint dwFlags, IntPtr dwExtraInfo);
10
#endregion
11
#region 常量
12
private const int KEYEVENTF_KEYDOWN = 0x0000; // Key down flag
13
private const int KEYEVENTF_KEYUP = 0x0002; // Key up flag
14
#endregion
15
public static void PressKey(char key)
16
{
17
byte keyCode = (byte)key;
18
keybd_event(keyCode, 0, KEYEVENTF_KEYDOWN, IntPtr.Zero);
19
keybd_event(keyCode, 0, KEYEVENTF_KEYUP, IntPtr.Zero);
20
}
21
public static void InputKeys(string keys)
22
{
23
foreach (var key in keys)
24
{
25
byte keyCode = (byte)key;
26
keybd_event(keyCode, 0, KEYEVENTF_KEYDOWN, IntPtr.Zero);
27
keybd_event(keyCode, 0, KEYEVENTF_KEYUP, IntPtr.Zero);
28
}
29
}
30
}
@@ -0,0 +1,9 @@
1
<Project Sdk="Microsoft.NET.Sdk">
2
3
<PropertyGroup>
4
<TargetFramework>net8.0</TargetFramework>
5
<ImplicitUsings>enable</ImplicitUsings>
6
<Nullable>enable</Nullable>
7
</PropertyGroup>
8
9
</Project>