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. Visual Basic
  4. How to Get Login and Log off information in Windows [modified]

How to Get Login and Log off information in Windows [modified]

Scheduled Pinned Locked Moved Visual Basic
databasehelptutorial
19 Posts 5 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.
  • I i i i

    Thanks for the reply , actually i did this for the first time not most of the time ;P

    SOFTDEV Luck in life always exists in the form of an abstract class that cannot be instantiated directly and needs to be inherited by hard work and dedication.

    L Offline
    L Offline
    Luc Pattyn
    wrote on last edited by
    #9

    I admit there have been times you did not even find code. :-D

    Luc Pattyn [Forum Guidelines] [My Articles] Nil Volentibus Arduum

    Please use <PRE> tags for code snippets, they preserve indentation, improve readability, and make me actually look at the code.

    I 2 Replies Last reply
    0
    • L Lost User

      S0FTDEV wrote:

      i need any guide line so i can get
      User Login and out time.

      Asking for help begins with "I tried X and it did Y instead of Z, where am I going wrong?". Try to explain what functionality you're after, as opposed to dropping a snippet with your needs. Is your computer in a domain (validating your credentials against some Windows Server) or on a workgroup? (local credentials) Write a console-app that gets launched when the user logs in (put a link in the startup folder). You could keep it running, doing nothing, and write down the time again when Windows closes your application (on shutdown, Windows informs your app why it's being closed) I'm not sure whether the Active Directory keeps this information around, but the above should work under all circumstances.

      I are Troll :suss:

      I Offline
      I Offline
      i i i
      wrote on last edited by
      #10

      Please read the question i mentioned i googled and code is also there that what problem is in it. :(

      SOFTDEV Luck in life always exists in the form of an abstract class that cannot be instantiated directly and needs to be inherited by hard work and dedication.

      L 1 Reply Last reply
      0
      • L Luc Pattyn

        I admit there have been times you did not even find code. :-D

        Luc Pattyn [Forum Guidelines] [My Articles] Nil Volentibus Arduum

        Please use <PRE> tags for code snippets, they preserve indentation, improve readability, and make me actually look at the code.

        I Offline
        I Offline
        i i i
        wrote on last edited by
        #11

        :-\ , so you are admitting that i put it for the first time , so from where your 1st statement came :P

        SOFTDEV Luck in life always exists in the form of an abstract class that cannot be instantiated directly and needs to be inherited by hard work and dedication.

        1 Reply Last reply
        0
        • L Luc Pattyn

          I admit there have been times you did not even find code. :-D

          Luc Pattyn [Forum Guidelines] [My Articles] Nil Volentibus Arduum

          Please use <PRE> tags for code snippets, they preserve indentation, improve readability, and make me actually look at the code.

          I Offline
          I Offline
          i i i
          wrote on last edited by
          #12

          Did i asked for code ever ,,,, MVP :rose:

          SOFTDEV Luck in life always exists in the form of an abstract class that cannot be instantiated directly and needs to be inherited by hard work and dedication.

          L 1 Reply Last reply
          0
          • I i i i

            Please read the question i mentioned i googled and code is also there that what problem is in it. :(

            SOFTDEV Luck in life always exists in the form of an abstract class that cannot be instantiated directly and needs to be inherited by hard work and dedication.

            L Offline
            L Offline
            Lost User
            wrote on last edited by
            #13

            I have also posted a possible solution to the stated problem. Didn't it work?

            I are Troll :suss:

            1 Reply Last reply
            0
            • I i i i

              Did i asked for code ever ,,,, MVP :rose:

              SOFTDEV Luck in life always exists in the form of an abstract class that cannot be instantiated directly and needs to be inherited by hard work and dedication.

              L Offline
              L Offline
              Luc Pattyn
              wrote on last edited by
              #14

              It often is not clear what you want. You seem to have an idea or a need, don't provide much information, don't tell what you have tried nor what exact problem you encountered, and sometimes you don't even ask a question at all. example 1[^] example 2[^] example 3[^] I suggest you improve your enquiring style and show more of what you tried, it will result in more, better, and sooner answers. :)

              Luc Pattyn [Forum Guidelines] [My Articles] Nil Volentibus Arduum

              Please use <PRE> tags for code snippets, they preserve indentation, improve readability, and make me actually look at the code.

              I 1 Reply Last reply
              0
              • I i i i

                thanks in advance i got this code while googled but not working , in this code its giving errors like ManagementScope is not defined , ObjectQuery is not defined , I am not preferring this code, any help will be appreciated.

                Imports System.Management

                Public Class Form2

                Private Sub Button1\_Click( \_
                    ByVal sender As System.Object, \_
                    ByVal e As System.EventArgs \_
                ) Handles Button1.Click
                
                    Dim ms As New ManagementScope("\\root\\cimv2")
                    Dim oq As New ObjectQuery("Select \* from Win32\_Session")
                    Dim query As New ManagementObjectSearcher(ms, oq)
                    Dim queryCollection As ManagementObjectCollection = query.\[Get\]()
                
                    For Each mo As ManagementObject In queryCollection
                        If mo("LogonType").ToString().Equals("2") Then
                            '  2 - for logged on User
                            MessageBox.Show("Started Time: " + mo("StartTime").ToString)
                        End If
                    Next
                End Sub
                

                End Class

                Any suggestions

                SOFTDEV Luck in life always exists in the form of an abstract class that cannot be instantiated directly and needs to be inherited by hard work and dedication.

                modified on Monday, March 28, 2011 5:29 AM

                D Offline
                D Offline
                Dave Kreskowiak
                wrote on last edited by
                #15

                You really need to sit down with a beginners book on .NET and work through it. It appears that you're missing a reference to System.Management.dll.

                A guide to posting questions on CodeProject[^]
                Dave Kreskowiak

                I 1 Reply Last reply
                0
                • L Luc Pattyn

                  It often is not clear what you want. You seem to have an idea or a need, don't provide much information, don't tell what you have tried nor what exact problem you encountered, and sometimes you don't even ask a question at all. example 1[^] example 2[^] example 3[^] I suggest you improve your enquiring style and show more of what you tried, it will result in more, better, and sooner answers. :)

                  Luc Pattyn [Forum Guidelines] [My Articles] Nil Volentibus Arduum

                  Please use <PRE> tags for code snippets, they preserve indentation, improve readability, and make me actually look at the code.

                  I Offline
                  I Offline
                  i i i
                  wrote on last edited by
                  #16

                  lol, i will try to improve :cool:

                  SOFTDEV Luck in life always exists in the form of an abstract class that cannot be instantiated directly and needs to be inherited by hard work and dedication.

                  1 Reply Last reply
                  0
                  • D Dave Kreskowiak

                    You really need to sit down with a beginners book on .NET and work through it. It appears that you're missing a reference to System.Management.dll.

                    A guide to posting questions on CodeProject[^]
                    Dave Kreskowiak

                    I Offline
                    I Offline
                    i i i
                    wrote on last edited by
                    #17

                    well, thanks for reply , definitely to learn , i will even stand :)

                    SOFTDEV Luck in life always exists in the form of an abstract class that cannot be instantiated directly and needs to be inherited by hard work and dedication.

                    1 Reply Last reply
                    0
                    • L Lost User

                      S0FTDEV wrote:

                      i need any guide line so i can get
                      User Login and out time.

                      Asking for help begins with "I tried X and it did Y instead of Z, where am I going wrong?". Try to explain what functionality you're after, as opposed to dropping a snippet with your needs. Is your computer in a domain (validating your credentials against some Windows Server) or on a workgroup? (local credentials) Write a console-app that gets launched when the user logs in (put a link in the startup folder). You could keep it running, doing nothing, and write down the time again when Windows closes your application (on shutdown, Windows informs your app why it's being closed) I'm not sure whether the Active Directory keeps this information around, but the above should work under all circumstances.

                      I are Troll :suss:

                      I Offline
                      I Offline
                      imen532
                      wrote on last edited by
                      #18

                      hi plz i have function but i d'ont know declared on program vb.net function .math Please help me because I am in very big trouble and I need to have this day its simple function of diagramme rayonnement

                      L 1 Reply Last reply
                      0
                      • I imen532

                        hi plz i have function but i d'ont know declared on program vb.net function .math Please help me because I am in very big trouble and I need to have this day its simple function of diagramme rayonnement

                        L Offline
                        L Offline
                        Lost User
                        wrote on last edited by
                        #19

                        imen532 wrote:

                        hi plz i have function but i d'ont know declared on program vb.net
                        function .math

                        Using the functions of the Math class[^]; there's examples on the bottom of that page.

                        imen532 wrote:

                        Please help me because

                        You'd get more reactions if you started a new thread, and formulated a specific question on what you want help with ("Math" is a bit general)

                        imen532 wrote:

                        and I need to have this day

                        Wrong deadline, especially at this price.

                        I are Troll :suss:

                        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