Logon time, up time etc...

Collapse
This topic is closed.
X
X
 
  • Time
  • Show
Clear All
new posts
  • AttiDude

    Logon time, up time etc...

    Hi, I need some help with some code.

    I need to know how long the computer is online or how long the user
    has been logged in.

    Ok I have a few options:

    -Take a file that has been created at startup and display his creation
    date. (tried this, but its difficult to convert the date and time to
    how long it has been on)

    -systemmonitorco ntrol. This one displays how long computer has been on
    in seconds. Only this format is not easy to convert. It seams that on
    every count it places some random spaces and dots. (I tried this one
    aswell)

    OK other options...

    When pressing ctrl+alt+delete on computer you can see how long you are
    logged in. Isnt the an easy way to get this? Maybe an API? Then is my
    question which API?

    So simple and so difficult...

    Thanks.

    Grtz,
    Sander


    BTW: Yes I searched google!
  • Korejwa

    #2
    Re: Logon time, up time etc...

    On Thu, 01 Apr 2004 15:26:32 +0200, AttiDude
    <attidude1*nosp am*@hotmail.com > wrote:
    [color=blue]
    > Hi, I need some help with some code.
    >
    > I need to know how long the computer is online or how long the user
    > has been logged in.
    >
    > Ok I have a few options:
    >
    > -Take a file that has been created at startup and display his creation
    > date. (tried this, but its difficult to convert the date and time to
    > how long it has been on)
    >
    > -systemmonitorco ntrol. This one displays how long computer has been on
    > in seconds. Only this format is not easy to convert. It seams that on
    > every count it places some random spaces and dots. (I tried this one
    > aswell)
    >
    > OK other options...
    >
    > When pressing ctrl+alt+delete on computer you can see how long you are
    > logged in. Isnt the an easy way to get this? Maybe an API? Then is my
    > question which API?
    >
    > So simple and so difficult...
    >
    > Thanks.
    >
    > Grtz,
    > Sander
    >
    >
    > BTW: Yes I searched google![/color]

    Try this:


    Comment

    • AttiDude

      #3
      Re: Logon time, up time etc...

      On Thu, 01 Apr 2004 23:26:15 GMT, Korejwa <korejwa@tiac.n et> wrote:
      [color=blue]
      >On Thu, 01 Apr 2004 15:26:32 +0200, AttiDude
      ><attidude1*nos pam*@hotmail.co m> wrote:
      >[color=green]
      >> Hi, I need some help with some code.
      >>
      >> I need to know how long the computer is online or how long the user
      >> has been logged in.
      >>
      >> Ok I have a few options:
      >>
      >> -Take a file that has been created at startup and display his creation
      >> date. (tried this, but its difficult to convert the date and time to
      >> how long it has been on)
      >>
      >> -systemmonitorco ntrol. This one displays how long computer has been on
      >> in seconds. Only this format is not easy to convert. It seams that on
      >> every count it places some random spaces and dots. (I tried this one
      >> aswell)
      >>
      >> OK other options...
      >>
      >> When pressing ctrl+alt+delete on computer you can see how long you are
      >> logged in. Isnt the an easy way to get this? Maybe an API? Then is my
      >> question which API?
      >>
      >> So simple and so difficult...
      >>
      >> Thanks.
      >>
      >> Grtz,
      >> Sander
      >>
      >>
      >> BTW: Yes I searched google![/color]
      >
      >Try this:
      >
      >http://msdn.microsoft.com/library/de...ndows_time.asp[/color]


      Thanks!
      Ok for people who want to know. It is an API. Use the GetTickCount
      API.
      Cheers!

      Comment

      • Raoul Watson

        #4
        Re: Logon time, up time etc...


        "AttiDude" <attidude1*nosp am*@hotmail.com > wrote in message
        news:03qq60hc7q jlq9885j860quop 3g2o21b3d@4ax.c om...[color=blue]
        > On Thu, 01 Apr 2004 23:26:15 GMT, Korejwa <korejwa@tiac.n et> wrote:
        >[color=green]
        > >On Thu, 01 Apr 2004 15:26:32 +0200, AttiDude
        > ><attidude1*nos pam*@hotmail.co m> wrote:
        > >[color=darkred]
        > >> Hi, I need some help with some code.
        > >>
        > >> I need to know how long the computer is online or how long the user
        > >> has been logged in.
        > >>
        > >> Ok I have a few options:
        > >>
        > >> -Take a file that has been created at startup and display his creation
        > >> date. (tried this, but its difficult to convert the date and time to
        > >> how long it has been on)
        > >>
        > >> -systemmonitorco ntrol. This one displays how long computer has been on
        > >> in seconds. Only this format is not easy to convert. It seams that on
        > >> every count it places some random spaces and dots. (I tried this one
        > >> aswell)
        > >>
        > >> OK other options...
        > >>
        > >> When pressing ctrl+alt+delete on computer you can see how long you are
        > >> logged in. Isnt the an easy way to get this? Maybe an API? Then is my
        > >> question which API?
        > >>
        > >> So simple and so difficult...
        > >>
        > >> Thanks.
        > >>
        > >> Grtz,
        > >> Sander
        > >>
        > >>
        > >> BTW: Yes I searched google![/color]
        > >
        > >Try this:
        > >[/color]
        >
        >http://msdn.microsoft.com/library/de...-us/sysinfo/ba[/color]
        se/windows_time.as p[color=blue]
        >
        >
        > Thanks!
        > Ok for people who want to know. It is an API. Use the GetTickCount
        > API.
        > Cheers![/color]

        Well.. that just gives miliseconds since Windows was started but it can't
        tell you if a user is logged in as you stated in your original post (i.e.
        the PC could just be on but no one is using it). I that suits your needs,
        fine. If not, you want want to think of placing a program in the user
        startup folder and write to a file the login time. You mentioned this but
        was worried about calculating the length with a time stamp. You can use the
        DateDiff function for this.


        Comment

        Working...