Running a Windows Store Application From Windows Forms

Posted by Ibrahim Ersoy Articles | Windows Store Apps November 24, 2012
Before writing this article, I searched all over the Internet and was surprised that no one has ever thought of the power of "SendKeys".
Reader Level:
Download Files:

If you have used Windows 8 for at least a couple of months and have become accustomed to it, you should now know that the Metro UI is very easy to use.

You can click on a Windows Key (left or right doesn't matter), then click on a Metro app and it runs. The alternative way to run it is by clicking the Windows Key, writing the name of the application and pressing Enter. It runs!

So while I analyze its working process, I thought maybe I can send keys to the Metro UI. I can actually run Metro UI applications from a Windows Forms or Console App.

So here's how to do it.

1- First of all create a new Windows Forms Project:


2- Add a Button and by double-clicking on it create a click event handler for it.

3- Use this code:


An Explaination:

1st sendkeys code:    simulates the Windows Key, which actually is a CTRL + ESC keys combination.
2nd sendkeys code:  searches for the application that will run. For that I suggest you have a look at your apps first.
3rd sendkeys code:   sends an Enter key that will run the Windows Store Application.

Dont forget to change the 2nd sendkeys parameter according to your own Windows 8 Environment.

4- Run it!

When I clicked on the button it ran the App.

So here are some screenshots to my project:










As you can see, the code works perfectly!

So long story short, you can use 3 lines of code to fulfill your wish.

It would be so kind of you, if you shared your experience with it, so that I can update my article according to your experience using the code above.

Hope it helps!