locked
How to simulate keyboard press in Metro App

    Question

  • I'd like to develop a Metro style App that a button clicked, it can switch to desktop mode. I'm thinking to use keyboard event to simulate Win+B. Can I?

     

    Wednesday, November 30, 2011 6:47 PM

Answers

All replies

  • I'd like to develop a Metro style App that a button clicked, it can switch to desktop mode. I'm thinking to use keyboard event to simulate Win+B. Can I?


    There’s no direct way to do this, and it would certainly be rather annoying for the user to unexpectedly find himself in desktop mode while running a metro app. A hackish workaround would be to use Launcher.LaunchDefaultProgram to launch a dummy file with a custom extension for which you have a registered desktop app. The desktop app should do nothing on execution (just exit immediately). This will achieve  the apparent effect of switching to desktop mode.


    http://blog.voidnish.com
    Wednesday, November 30, 2011 7:02 PM
  • Thank you for the work around. Actually, I'd like to know how to send key message in Metro App. Say you use OSD keyboard, you can not press alt-tab, or any win+key as shortcut. If I can send key message in Metro App, I can build a Metro App to provide all these functions.
    Wednesday, November 30, 2011 7:44 PM
  • There is no way for a Metro app to synthesize input.

    --Rob

    Wednesday, November 30, 2011 11:24 PM
    Owner