C# 弹出Windows系统内置的软键盘
|
admin
2025年10月19日 2:9
本文热度 387
|
[DllImport("kernel32.dll", SetLastError = true)]private static extern bool Wow64DisableWow64FsRedirection(ref IntPtr ptr);
[DllImport("kernel32.dll", SetLastError = true)]private static extern bool Wow64RevertWow64FsRedirection(IntPtr ptr);private void TspKeypad_Click(object sender, EventArgs e){ bool isKeyboadRunning = Process.GetProcessesByName("osk").Length > 0; if (isKeyboadRunning) return; IntPtr ptr = IntPtr.Zero; bool redirected = Wow64DisableWow64FsRedirection(ref ptr); try { Process.Start("osk.exe"); } finally { if (redirected) { Wow64RevertWow64FsRedirection(ptr); } }}
该文章在 2025/10/20 10:22:45 编辑过