using System; using Arp.Prova.PlayLib; //Keysイベントの為のライブラリ using System.Windows.Forms; //DLLを読込む為のライブラリ using System.Runtime.InteropServices; //このサンプルコードは、「Windowsキー」+「Mキー」を入力し、開いている画面を最小化します。 public class CodeClass { //user32.dllのkeybd_event関数を宣言 [DllImport("user32.dll")] public static extern uint keybd_event(byte bVk, byte bScan, uint dwFlags, UIntPtr dwExtraInfo); public static int CodeStart() { //左のウィンドウズキーを押す keybd_event((byte)Keys.LWin, 0, 0, (UIntPtr)0); //Mキーを押す keybd_event((byte)Keys.M, 0, 0, (UIntPtr)0); //Mキーを離す keybd_event((byte)Keys.M, 0, 2, (UIntPtr)0); //左のウィンドウズキーを離す keybd_event((byte)Keys.LWin, 0, 2, (UIntPtr)0); return 0; } }