Simulate "Windows" key and "+" key to zoom in
Asked Answered
P

3

3

Windows 7 (finally) has built-in zoom feature for the screen. Hold down the "Windows" key and you can then use the "+" key to zoom in and the "-" key to zoom out. As a result I have been trying to simulate this combination. With AutoIt I have 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 those 4 steps work...

I actually want to use this functionality on c#. If I manage to do it with autoit I could invoke that script with c# so I don't mind the langauage. I am also simulating keystrokes because I don't know how I will be able to zoom in using c#.

Possession answered 11/5, 2012 at 5:48 Comment(1)
Process.Start("Magnify.exe");Arsenious
P
5

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);
Possession answered 11/5, 2012 at 12:50 Comment(0)
B
4

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

Brightman answered 29/10, 2012 at 0:13 Comment(0)
H
0

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}");
        }
Handbill answered 11/5, 2012 at 6:45 Comment(0)

© 2022 - 2024 — McMap. All rights reserved.