Pressing Win + X, Alt-Tab programmatically

I am trying to simulate keypress events for Win + X in Windows 8 that should appear in a small menu, but I was not able to get this to work using SendInput. For any other key combination (for example, Win + R, Win + E, Win + D) it works, but not for Win + X. I noticed that Synergy + has the same problem, but this is not on the Windows on-screen keyboard. I also looked at the SendInput options that the on-screen keyboard uses, but if I use the exact same options in my application, I still don't get the menu.

So my question is, how do I get this to work? Or is there an alternative way to display this menu?

+6
source share
1 answer

I recently added support for this application. Glad we beat our competitor!

Windows 8 has new UIPI restrictions. The most commonly used locked shortcut is Alt + Tab , so you'll want to make a workaround.

You must mark your binaries uiAccess="true" in the manifest. (For more on how to do this, google.) This manifest prevents binary files from running if it is not signed with a Microsoft-approved code signing certificate and installed in a "safe place" (system32 or Program Files / Program Files (x86)). .

If you delay your program from any helpers: the uiAccess binary cannot be started with CreateProcess from the environment integrity process (the manifest notes that it requires "high" integrity). Instead, it is easiest to run it with ShellExecute "open" to force the shell to pick it up. If you are using CreateProcessAsUser , you need to set TokenUIAccess to 1 using SetTokenInformation , or the launch will fail.

Final points: note that uiAccess pretty much limits what the process can do. You cannot receive user interface input from normal (medium integrity) processes, so other applications cannot interact with your windows. If you do not follow the proper methods of dividing your user interface into a separate process, this will therefore be a good reason for this. Alternatively, tasks that require uiAccess can be placed in a small standalone auxiliary binary and completely separate from the non-user interface. Your main application can run it as a high-level helper process that sends the instructions necessary to complete these specific tasks (for example, SendInput ).

Finally, SendInput will work.

+3
source

All Articles