Skip to content
  • Categories
  • Recent
  • Tags
  • Popular
  • World
  • Users
  • Groups
Skins
  • Light
  • Cerulean
  • Cosmo
  • Flatly
  • Journal
  • Litera
  • Lumen
  • Lux
  • Materia
  • Minty
  • Morph
  • Pulse
  • Sandstone
  • Simplex
  • Sketchy
  • Spacelab
  • United
  • Yeti
  • Zephyr
  • Dark
  • Cyborg
  • Darkly
  • Quartz
  • Slate
  • Solar
  • Superhero
  • Vapor

  • Default (No Skin)
  • No Skin
Collapse
Code Project
  1. Home
  2. General Programming
  3. C / C++ / MFC
  4. Login& Logout Time

Login& Logout Time

Scheduled Pinned Locked Moved C / C++ / MFC
tutorialquestion
7 Posts 3 Posters 0 Views 1 Watching
  • 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.
  • L Offline
    L Offline
    leonigah
    wrote on last edited by
    #1

    How to get Windows user's Login and Logout time?

    Nigah M Manzoor

    N D L 3 Replies Last reply
    0
    • L leonigah

      How to get Windows user's Login and Logout time?

      Nigah M Manzoor

      N Offline
      N Offline
      Nibu babu thomas
      wrote on last edited by
      #2

      Using COM it's possible, though I haven't used it at all, just did a quick search and found this for you... IADsUser COM interface provides these methods for you, google for more information...

      get_LastLogin
      get_LastLogoff

      Nibu thomas Microsoft MVP for VC++ Code must be written to be read, not by the compiler, but by another human being. Programming Blog: http://nibuthomas.wordpress.com

      L 2 Replies Last reply
      0
      • L leonigah

        How to get Windows user's Login and Logout time?

        Nigah M Manzoor

        D Offline
        D Offline
        David Crow
        wrote on last edited by
        #3

        You might look into the ISensLogon interface.

        "Love people and use things, not love things and use people." - Unknown

        "To have a respect for ourselves guides our morals; to have deference for others governs our manners." - Laurence Sterne

        1 Reply Last reply
        0
        • N Nibu babu thomas

          Using COM it's possible, though I haven't used it at all, just did a quick search and found this for you... IADsUser COM interface provides these methods for you, google for more information...

          get_LastLogin
          get_LastLogoff

          Nibu thomas Microsoft MVP for VC++ Code must be written to be read, not by the compiler, but by another human being. Programming Blog: http://nibuthomas.wordpress.com

          L Offline
          L Offline
          leonigah
          wrote on last edited by
          #4

          thanx,

          Nigah M Manzoor

          1 Reply Last reply
          0
          • N Nibu babu thomas

            Using COM it's possible, though I haven't used it at all, just did a quick search and found this for you... IADsUser COM interface provides these methods for you, google for more information...

            get_LastLogin
            get_LastLogoff

            Nibu thomas Microsoft MVP for VC++ Code must be written to be read, not by the compiler, but by another human being. Programming Blog: http://nibuthomas.wordpress.com

            L Offline
            L Offline
            leonigah
            wrote on last edited by
            #5

            thanx, its working

            Nigah M Manzoor

            N 1 Reply Last reply
            0
            • L leonigah

              thanx, its working

              Nigah M Manzoor

              N Offline
              N Offline
              Nibu babu thomas
              wrote on last edited by
              #6

              leonigah wrote:

              thanx, its working

              Welcome. I am curious to see the code! Is it possible? :)

              Nibu thomas Microsoft MVP for VC++ Code must be written to be read, not by the compiler, but by another human being. Programming Blog: http://nibuthomas.wordpress.com

              1 Reply Last reply
              0
              • L leonigah

                How to get Windows user's Login and Logout time?

                Nigah M Manzoor

                L Offline
                L Offline
                leonigah
                wrote on last edited by
                #7

                #include #include #include #pragma comment (lib, "ActiveDS.lib") #pragma comment (lib, "Adsiid.lib") void CSysInfoDlg::OnOK() { IADsContainer *pCont = NULL; CString str = "WinNT://DOMEN_NAME"; HRESULT hr = ADsGetObject(str.AllocSysString(), IID_IADsContainer, (void**) &pCont ); if(!SUCCEEDED(hr)) return; ULONG ulFetched = 0L; _variant_t var; _variant_t vChild; IEnumVARIANTPtr pEnum; ADsBuildEnumerator(pCont,&pEnum); while((SUCCEEDED(ADsEnumerateNext(pEnum, 1, &vChild, &ulFetched)) && ulFetched==1)) { IADsUser* pADs = NULL; hr = V_DISPATCH(&vChild)->QueryInterface(IID_IADsUser, (void**)&pADs); if(hr!=S_OK) break; DATE din = 0; pADs->get_LastLogin(&din); COleDateTime d(din); CString strIn = d.Format("%d-%m-%Y %H:%M"); DATE dout = 0; pADs->get_LastLogoff(&dout); COleDateTime d1(dout); CString strOut = d1.Format("%d-%m-%Y %H:%M"); BSTR bstrName; pADs->get_Name(&bstrName); CString strName = bstrName; SysFreeString(bstrName); pADs->Release(); pADs = NULL; MessageBox(strIn+"=="+strOut, strName); } if(pCont) pCont->Release(); }

                Nigah M Manzoor

                1 Reply Last reply
                0
                Reply
                • Reply as topic
                Log in to reply
                • Oldest to Newest
                • Newest to Oldest
                • Most Votes


                • Login

                • Don't have an account? Register

                • Login or register to search.
                • First post
                  Last post
                0
                • Categories
                • Recent
                • Tags
                • Popular
                • World
                • Users
                • Groups