Simulate the Windows and + keys to enlarge

Windows 7 (finally) has a built-in zoom function for the screen. While holding down the "Windows" key, you can use the "+" key to enlarge and the "-" key to decrease. As a result, I tried to imitate this combination. Using AutoIt, I tried:

1)

Send("{LWINDOWN}" & "+" & "{LWINUP}")

2)

$x = Chr(43)
Send("{LWINDOWN}" & $x & "{LWINUP}")

3)

Send("#{+}") ;//works but it also sends "+" key

4)

Send("{LWINDOWN}")
Sleep(10)
Send("+",1)
Sleep(10)
Send("{LWINUP}")

None of these 4 steps work ...

I really want to use this feature in C #. If I manage to do this with autoit, I could call this script with C #, so I'm not against langauage. I also simulate keystrokes because I don't know how I can zoom in using C #.

+3
source share
3 answers

, :

http://inputsimulator.codeplex.com/

do:

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

... - ( "{LWIN DOWN}" "+" "{LWIN UP}" ).

+4

You can do something like this

SendKeys.SendWait("{F1}");

If you want to call it one window, 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}");
        }
0
source

All Articles