Simulate “Windows” key and “+” key to zoom in

北慕城南 提交于 2019-12-01 00:07:36

Import the library located at:

http://inputsimulator.codeplex.com/

then do:

 WindowsInput.InputSimulator.SimulateKeyDown
                          (WindowsInput.VirtualKeyCode.LWIN);
 WindowsInput.InputSimulator.SimulateKeyPress
                          (WindowsInput.VirtualKeyCode.OEM_PLUS);
 WindowsInput.InputSimulator.SimulateKeyUp
                          (WindowsInput.VirtualKeyCode.LWIN);

You almost had it right ... the actual syntax is Send("{LWIN DOWN}" & "+" & "{LWIN UP}").

You can do something like this

SendKeys.SendWait("{F1}");

If you want to call it to somewindow you can use

 [DllImport("user32.dll")]
public static extern int SetForegroundWindow(IntPtr hWnd);

and then

Process[] processes = Process.GetProcessesByName("Some.exe");

        foreach(Process proc in processes)
        {
            SetForegroundWindow(proc.MainWindowHandle);
            SendKeys.SendWait("{F1}");
        }
易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!