I've created a UWP app. In which, i have a button, so when the user clicks this button the system should shutdown. Please help me....
I've created a UWP app. In which, i have a button, so when the user clicks this button the system should shutdown. Please help me....
Hello, Welcome to Micorosoft Q&A,
UWP platfrom contain BeginShutdown method, but the method only applicable to IOT device, such as raspberry pie with iot specific OS. And it will not work for Windows 10 normal os, if you do want to shut down device, we suggest you use desktop bridge to make desktop extension for uwp app and shut down computer with Win32 api Process.Start("shutdown", "/s /f /t 0");.
If the response is helpful, please click "Accept Answer" and upvote it.
Note: Please follow the steps in our documentation to enable e-mail notifications if you want to receive the related email notification for this thread.
This "Process.Start("shutdown", "/s /f /t 0");" isn't working for me. Will you please tell me a clear procedure on how to use desktop bridge to make desktop extension for uwp app and shut down computer with Win32 api???
Please refer stefan's blog UWP with Desktop Extension, it contains code sample. And If the response is helpful, please click "Accept Answer" and upvote it.
Ok so this thing, i've tried it. And i am already running a batch file on a button click and its running properly. But can we run another (more than one) batch file in a single application???
Like i've two buttons 1. Start 2. Shutdown. When i press 'Start' button a batch file is getting executed. Now if i press "shutdown" another batch file should get executed. Will that happen??? I hope stefans post refers to the same thing that i am talking about.
I hope that at least one of the following helps.
7 people are following this question.