Answered Can not simulate Win+D on Metro UI in Windows 8?

  • Thursday, August 02, 2012 2:19 AM
     
     

    I want to switch Metro UI to desktop. Simulate Win+D can work on traditional desktop, but can not work on Metro UI. Code as below:

      keybd_event(VK_LWIN, MapVirtualKeyEx(VK_LWIN,0,GetKeyboardLayout(0)),  0, 0);
        Sleep(30);
        keybd_event(VK_D  ,MapVirtualKeyEx(VK_D,0,GetKeyboardLayout(0)) ,  0, 0);
        Sleep(30);

        keybd_event(VK_D , MapVirtualKeyEx(VK_D,0,GetKeyboardLayout(0)) ,   KEYEVENTF_KEYUP,0);
        Sleep(30);
        keybd_event(VK_LWIN, MapVirtualKeyEx(VK_LWIN,0,GetKeyboardLayout(0)), KEYEVENTF_KEYUP,0);

    Win+C can work well. Please tell me why it can not work well.

All Replies

  • Thursday, August 02, 2012 12:19 PM
     
     Answered
    My best guess would be that this is made on purpose to make sure no one create for instance an app which will simulate Win+D minimizing to the desktop after login. MS wants all users to land on the metro start panel and have made many blockers for coming directly to the desktop at login.

    Blogging about Windows for IT pros at www.theexperienceblog.com

  • Friday, August 03, 2012 5:26 AM
    Moderator
     
     Answered
    Do you try to send key in the Metro App, unfortunately, it is no allowed (keybd_event is Desktop onlyhttp://msdn.microsoft.com/en-us/library/windows/desktop/ms646304(v=vs.85).aspx), and cannot send the key Win+D via code to switch to the desktop feom Metro App.

    Bob Bao [MSFT]
    MSDN Community Support | Feedback to us

  • Monday, August 06, 2012 6:18 AM
     
     
    Do you try to send key in the Metro App, unfortunately, it is no allowed (keybd_event is Desktop onlyhttp://msdn.microsoft.com/en-us/library/windows/desktop/ms646304(v=vs.85).aspx), and cannot send the key Win+D via code to switch to the desktop feom Metro App.

    Bob Bao [MSFT]
    MSDN Community Support | Feedback to us


    Win+C can work, why Win+D can't work?
  • Monday, August 06, 2012 6:37 AM
    Moderator
     
     
    Do you mean call keybd_event function in Metro App? This function as I said is for desktop app only.

    Bob Bao [MSFT]
    MSDN Community Support | Feedback to us



  • Monday, August 20, 2012 3:51 AM
     
     
    I call  keybd_event in Destop app when cursor on Metro Start Menu,  Win+C can work but Win+D can't work.