2

As title says everything clear. I want to open this menu via my Windows Application. Thanks.

enter image description here

ΦXocę 웃 Пepeúpa ツ
  • 47,427
  • 17
  • 69
  • 97
Dicaste
  • 31
  • 5

2 Answers2

1

Use the following code:

    private void button1_Click(object sender, EventArgs e)
    {
        KeyDown(ConsoleKey.LeftWindows);
        KeyDown(ConsoleKey.P);
        KeyUp(ConsoleKey.LeftWindows);
        KeyUp(ConsoleKey.P);
    }

    [System.Runtime.InteropServices.DllImport("user32.dll")]
    private static extern void keybd_event(byte bVk, byte bScan, int dwFlags, int dwExtraInfo);
    private const int KEYEVENTF_EXTENDEDKEY = 1;
    private const int KEYEVENTF_KEYUP = 2;
    public static void KeyDown(ConsoleKey vKey)
    {
        keybd_event((byte)vKey, 0, KEYEVENTF_EXTENDEDKEY, 0);
    }
    public static void KeyUp(ConsoleKey vKey)
    {
        keybd_event((byte)vKey, 0, KEYEVENTF_EXTENDEDKEY | KEYEVENTF_KEYUP, 0);
    }
Nathan
  • 541
  • 1
  • 4
  • 20
0

Use code like in this post:

SendKeys.Send and Windows Key

to send your Windows+P keystrokes.

Community
  • 1
  • 1
Kory Gill
  • 6,993
  • 1
  • 25
  • 33