Skip to content
  • Categories
  • Recent
  • Tags
  • Popular
  • Users
  • Groups
  • Search
  • Get Qt Extensions
  • Unsolved
Collapse
Brand Logo
  1. Home
  2. Qt Development
  3. General and Desktop
  4. How to get USER ACCOUNT ID in windows?

How to get USER ACCOUNT ID in windows?

Scheduled Pinned Locked Moved Solved General and Desktop
windowsdesktopaccount
3 Posts 2 Posters 2.9k Views
  • Oldest to Newest
  • Newest to Oldest
  • Most Votes
Reply
  • Reply as topic
Log in to reply
This topic has been deleted. Only users with topic management privileges can see it.
  • T Offline
    T Offline
    Tusharh
    wrote on last edited by
    #1

    I'm trying to get user account id in windows, but no success. I tried QProcess but isn't possible.
    C# gives this in below code -
    int sessionId = System.Diagnostics.Process.GetCurrentProcess().SessionId;

    Here is the screen shot of task manager which shows you the ID of user - https://hub.mangoapps.com/sf/ODE0MDRfMTMwMDg1Ng

    Thanks in advance.

    1 Reply Last reply
    0
    • M Offline
      M Offline
      matobodo
      wrote on last edited by
      #2

      Here are some links that might help you
      http://stackoverflow.com/questions/14034666/how-to-query-a-users-session-id-under-windows
      https://msdn.microsoft.com/en-us/library/bb432286(v=vs.85).aspx
      https://msdn.microsoft.com/en-us/library/windows/desktop/ms724953(v=vs.85).aspx

      1 Reply Last reply
      2
      • T Offline
        T Offline
        Tusharh
        wrote on last edited by
        #3

        @matobodo Thanks! The links helped.
        Get process id from GetCurrentProcessID() & ProcessIdToSessionId() gives you session id by inputting process id.
        #include<windows.h> to access these methods.

        1 Reply Last reply
        0

        • Login

        • Login or register to search.
        • First post
          Last post
        0
        • Categories
        • Recent
        • Tags
        • Popular
        • Users
        • Groups
        • Search
        • Get Qt Extensions
        • Unsolved