windows 8 block alt-tab simulation RRS feed

  • Question

  • windows 7  OK

    // Simulating a Alt+Tab keystroke
    keybd_event(VK_MENU,0xb8,0 , 0); //Alt Press
    keybd_event(VK_TAB,0x8f,0 , 0); // Tab Press
    keybd_event(VK_TAB,0x8f, KEYEVENTF_KEYUP,0); // Tab Release
    keybd_event(VK_MENU,0xb8,KEYEVENTF_KEYUP,0); // Alt Release

    Using the same on windows 8 fail.
    Tried as guest, admin and "elevated admin".

    Other key combinations (special with the win key) also fail... it's not only alt-tab.

    Did someone already solved this issue?

    Tuesday, September 18, 2012 2:28 PM

All replies

  • try set uiAccess=true in manifest file
    Wednesday, September 19, 2012 4:26 PM
  • Hi, in Windows 8, simulation of keyboard input which can trigger responses in the Shell aren’t guaranteed to work unless the application is an assistive technology application which has UIAccess privileges.

    The MSDN description of SendInput() at, has a comment on a related subject, “An accessibility application can use SendInput to inject keystrokes corresponding to application launch shortcut keys that are handled by the shell. This functionality is not guaranteed to work for other types of applications.”



    Wednesday, September 19, 2012 7:40 PM
  • When i understand correct
    win7 <=  uiAccess=true  and "runas admin" act the same
    Till win7 you could use sendinput to all applications if you were running at the highest elevation level ( runas admin)

    win8>= uiaccess=true and "runas admin" behave different.
    -For UAC windows you need "runas admin"
    -For Global hotkey you need  "uiaccess=true"
    Is there any documentation about this's coding in the dark :)

    In my case ( ultravnc)

    App run as service.
    Service restart himself using Createprocessasuser() in the console/user session
    I remember uiaccess=yes was blocking something in this case.... to long ago.
    I will do some test with uiaccess=true to verify if this solves it or not.

    Thanks for the feedback.


    In the Windows 8 security model, apps don’t have the privileges required to be a UI automation client. But you can write a desktop app that acts as an automation client with your app as the target. To do this, your desktop automation client app needs to be built with UIAccess permissions as outlined in

    • Edited by rudidevos Friday, September 21, 2012 8:49 PM
    Friday, September 21, 2012 1:56 PM
  • It doesn't work.

    Added uiAccess=true and signed exe.
    Result the same, works on win7, fail on win8.
    Using uiAccess=true, Createprocessasuser() fail to be called from service.. was expecting that one , same as on win7.

    Does anyone has another idea ?

    It looks like global hotkeys fail in win8

    ctrl-v/ctr-c OK
    winkey OK
    alt-tab FAIL
    winkey+x FAIL

    • Edited by rudidevos Friday, September 21, 2012 8:49 PM
    Friday, September 21, 2012 6:35 PM
  • Indeed, it seems that uiaccess=true set is required.
    Found some docs that explained it.
    In win8 you need to handle alt-tab as SendSAS();

    That's complex but at least i can reuse my code for it.

    Friday, September 21, 2012 9:11 PM
  • Hi Barker,

    I had the same problem.

    I modified the coade to Sendinput() command, but Alt+Tab function still cannot work.

    When I changed the code to Win+E/Win+M, the function can work normal.

    Does wi8 block Alt+Tab function in code development?

    Is there any spec for the function?

    Thanks for your support.

    Friday, October 12, 2012 1:40 AM
  • Hi rudidevos,

    Sorry to bother you.

    Could you also share the code to me?


    Monday, October 15, 2012 12:57 AM
  • I had solved the problem.

    Changed the manifest to have UIAccess="true" and require administrator, created a private test certificate, signed the application with that certificate, put it in a location under Program Files, and ran it.

    The "Alt+Tab" function can run in the code.

    • Proposed as answer by jarvis.chen Thursday, February 21, 2013 1:36 AM
    Thursday, February 21, 2013 1:36 AM
  • There does appear to be an additional constraint on being able to action Alt+Tab programmatically in Windows 8.

    It appears an application that has a suitable manifest, is signed and placed under Program Files is able to send Alt+Tab successfully. However when it is sent the only effect appears to be a slight flickering of the title bar of the current application, if in desktop mode. Adding a few Sleep calls to slow down the sending of the keystrokes solves the problem and full simulation of Alt+Tab can then be performed.

    Saturday, May 11, 2013 9:43 PM
  • Hi Jarvis!

    I am also facing the same problem as u faced, I could not simulate "Alt+Tab" key on window 8 , but code work fine for window 7 of course  using VS 2012.  I also included new Manifest file called "app.manifest" and changed

    "requestedExecutionLevel level ="Highest available ""  uiAccess ="true" in it

    But I get the error whenever I run it

    The application manifest has the uiAccess attribute set to 'true' running an accessibility application requires following steps described in help.
    and then I left with two button on same message box OK and Help, but when I clicked Help button on message Box, I  redirected to page 
    but I do not see any solution for my problem on that page.

    Am I doing any mistake in certificate creation? could u specify in detail how you created it and linked with your project.

    awaiting reply



    • Edited by Chandan02 Monday, September 30, 2013 11:07 AM Added new Question
    Monday, September 30, 2013 11:05 AM