如何在 uwp 中退出 Windows 10 程序? [英] how to sign out from windows 10 program in uwp?

查看:37
本文介绍了如何在 uwp 中退出 Windows 10 程序?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

如何使用 uwp 注销(退出)Windows 10?我在 win-forms 中做了,但代码在 uwp 中不起作用.

how to log off(sign out) windows 10 using uwp? I have do in win-forms but codes are not working in uwp.

     [DllImport("user32.dll")]
        public static extern int ExitWindowsEx(int operationFlag, int rationReason);

  private void button_Click(object sender, RoutedEventArgs e)
        {
            //Application.Current.Exit();

            ExitWindowsEx(0, 0);
        }

推荐答案

在非UWP程序中可以新建进程并运行

In non-UWP programme You can create a new process and run

%windir%\System32\shutdown.exe /l /t 0

但这不适用于 UWP 程序.查看 Stack Overflow 链接这里是另一个解决这个问题的方法.但看起来你运气不好.

But this is not available to UWP programmes. Check out the Stack Overflow link here for another take on this problem. But it looks like you are out of luck.

这篇关于如何在 uwp 中退出 Windows 10 程序?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆