-1

我想知道如何以编程方式将桌面切换到 Metro UI。我知道按 Windows 键可以做到这一点,但如何通过代码做同样的事情?

4

1 回答 1

2

对于桌面应用程序

  1. 你可以你的窗口服务主机。参考链接Pro-grammatically open window start menu

  2. 使用 P/Invoke 发送窗口密钥(来自链接

    private static extern int keybd_event(Byte bVk, Byte bScan, long dwFlags, long dwExtraInfo);
    private const byte UP = 2;
    private const byte CTRL = 17;
    private const byte ESC = 27;
    
    Finally on the event where you want to open start menu use :
    // Press Ctrl-Esc key to open Start menu
    keybd_event(CTRL, 0, 0, 0);
    keybd_event(ESC, 0, 0, 0);
    
    // Need to Release those two keys
    keybd_event(CTRL, 0, UP, 0);
    keybd_event(ESC, 0, UP, 0);
    

对于现代 UI 应用程序,由于 API 支持有限,我不确定是否可以这样做。

于 2012-11-26T12:14:36.877 回答