QT获取当前登录用户ID

时间:2017-02-27 09:15:04

标签: c++ qt

在c#中可以使用Process.GetCurrentProcess()。SessionId ..来获取Windows中的当前登录用户ID 在QT我们怎么能这样做?

enter image description here

1 个答案:

答案 0 :(得分:0)

您应该使用WinAPI。

你在C#中使用的只是糖,包装,因为C#创建用于Windows。 也许你需要的是GetCurrentProcessId方法,你可以找到它here

但是如果你只需要你的ID,你可以使用qint64 QCoreApplication :: applicationPid()。