修改依赖

This commit is contained in:
gongxh
2022-01-16 15:35:09 +08:00
parent 9e758a951f
commit 9b3b616f83
23 changed files with 40 additions and 837 deletions

View File

@@ -2,6 +2,7 @@
using System.Collections.Generic;
using System.Diagnostics;
using System.Linq;
using System.Management;
using System.Runtime.InteropServices;
using System.Text;
using System.Threading.Tasks;
@@ -23,11 +24,48 @@ namespace CleanMachineHMI
[DllImport("user32.dll", CharSet = CharSet.Auto, SetLastError = true)]
private static extern int RegisterWindowMessage(string lpString);
private static bool hasKeyboard=false;
private static readonly string USB = "USB";
static KeyboardAutoPopUp()
{
hasKeyboard = GetKeyboardPresent();
}
private static bool GetKeyboardPresent()
{
bool keyboardPresent = false;
ManagementObjectSearcher searcher = new ManagementObjectSearcher("Select * from Win32_Keyboard");
foreach (ManagementObject keyboard in searcher.Get())
{
foreach (PropertyData prop in keyboard.Properties)
{
if (Convert.ToString(prop.Value).Contains(USB))
{
keyboardPresent = true;
break;
}
}
}
return keyboardPresent;
}
//显示屏幕键盘
public static int ShowInputPanel()
{
if (hasKeyboard) return 0;
try
{
dynamic file = "C:\\Program Files\\Common Files\\microsoft shared\\ink\\TabTip.exe";
if (!System.IO.File.Exists(file))
return -1;