public void AppCommand(AppComandCode commandCode)
 {
     var windowInteropHelper = new WindowInteropHelper(_w);
     int CommandID = (int)commandCode << 16;
     try
     {
         _w.Dispatcher.Invoke(new Action(
                        () => SendMessageW(windowInteropHelper.Handle, WM_APPCOMMAND, windowInteropHelper.Handle, (IntPtr)CommandID)
                    ));
     }
     catch (Exception)
     {
         //Not a problem if a key doesn't trigger
     }
     
 }
Beispiel #2
0
        public static void AppCommand(AppComandCode commandCode)
        {
            int CommandID = (int)commandCode << 16;

            InteropHelper.SendMessageW(Process.GetCurrentProcess().MainWindowHandle, 0x319, Process.GetCurrentProcess().MainWindowHandle, (IntPtr)CommandID);
        }