locked
How to get windows log on, log off date from system using VS2005 RRS feed

  • Question

  •  

    Hi All,

     

    Can anyone please help how to get windows login and log off time from system? I am going to get this information from system using visual studio 2005(C#). But unfortunately I can't do it.

     

    From system process list I can only get windows logon time (This is the time I just start the PC) but I am looking for the time I just insert my user name and password and press the ok button into the windows log on page.

     

    Thanks in advance.

     

    Regards,

    Zakir


    Robi
    Wednesday, August 6, 2008 10:07 AM

Answers

  • You could try looking at the Winlogon notification package.  This allows you to hook up you're own dll up that gets notified when events such as logon/logoff occurr.  There may be a better way but this is one you could look at.

    Whoops - Winlogon doesn't work for Vista, it's been replaced with Service Control Manager (SCM) Notifications, these shoudl work on XP and Vista. 


    Jackson
    • Edited by Jackson McCann Wednesday, August 6, 2008 11:23 AM Updated info
    • Marked as answer by jack 321 Monday, August 11, 2008 2:44 AM
    Wednesday, August 6, 2008 11:02 AM
  • Hi Robi-Robo,

    According to MSDN document, A Winlogon notification package is a DLL that exports functions that handle Winlogon events. For example, when a user logs onto the system, Winlogon calls each notification package's logon event handler function to provide information about the event.

    In addition to this package and usage, please refer to the following articles and documents.

    Creating a Winlogon Notification Package

    Registering a Winlogon Notification Package

    Taking Advantage of the Winlogon Notification Package

    Regards,

    Xun


    Please remember to mark the replies as answers if they help and unmark them if they provide no help.
    • Marked as answer by jack 321 Monday, August 11, 2008 11:42 AM
    Friday, August 8, 2008 8:43 AM

All replies

  • You could try looking at the Winlogon notification package.  This allows you to hook up you're own dll up that gets notified when events such as logon/logoff occurr.  There may be a better way but this is one you could look at.

    Whoops - Winlogon doesn't work for Vista, it's been replaced with Service Control Manager (SCM) Notifications, these shoudl work on XP and Vista. 


    Jackson
    • Edited by Jackson McCann Wednesday, August 6, 2008 11:23 AM Updated info
    • Marked as answer by jack 321 Monday, August 11, 2008 2:44 AM
    Wednesday, August 6, 2008 11:02 AM
  • Please give me a detail description how to get this.
    Robi
    Wednesday, August 6, 2008 1:06 PM
  • Hi Robi-Robo,

    According to MSDN document, A Winlogon notification package is a DLL that exports functions that handle Winlogon events. For example, when a user logs onto the system, Winlogon calls each notification package's logon event handler function to provide information about the event.

    In addition to this package and usage, please refer to the following articles and documents.

    Creating a Winlogon Notification Package

    Registering a Winlogon Notification Package

    Taking Advantage of the Winlogon Notification Package

    Regards,

    Xun


    Please remember to mark the replies as answers if they help and unmark them if they provide no help.
    • Marked as answer by jack 321 Monday, August 11, 2008 11:42 AM
    Friday, August 8, 2008 8:43 AM
  • Hi  Xun,

    Thanks for your suggetions. This will be an excellent solution if i can make this. But unfortunately i cant make this. There was a header file needed during make the dll file in c++.

    However i got another solution using windows local security policy. By this i can trail the log in and log off time from the system events.

    Thanks,
    Zakir
    Robi
    Saturday, August 23, 2008 7:09 AM