CGI/Perl Guide | Learning Center | Forums | Advertise | Login
Site Search: in

  Main Index MAIN
INDEX
Search Posts SEARCH
POSTS
Who's Online WHO'S
ONLINE
Log in LOG
IN

Home: Perl Programming Help: Win32 Programming Help: Re: [mmahesh_mca] How to get the windows user login time: Edit Log



BillKSmith
Veteran

Apr 20, 2010, 10:35 AM


Views: 5153
Re: [mmahesh_mca] How to get the windows user login time

You misunderstood the definition of "logonHours". The array which you printed indicates that you have permission to logon at any time. The parameter that you want does not seem to be directly available. It can be computed from by subtracting "lastLogon" from time().

use strict;
use warnings;
use Win32API::Net qw(UserGetInfo);

my $Server = q();
my $Userid = q(mahesh);
my $Level = 2;
my %UserInfo;

UserGetInfo($Server, $Userid, $Level, \%UserInfo);
print
q(time since login: ),
time(),
qq( - $UserInfo{lastLogon} = ),
time() - $UserInfo{lastLogon},
q( seconds),
qq(\n);
;



I have tested this program with ActiveState 5.8.8 and Win32API::New '0.01' under XP HOME



Good Luck
Good Luck,
Bill

(This post was edited by BillKSmith on Apr 20, 2010, 11:42 AM)


Edit Log:
Post edited by BillKSmith (Veteran) on Apr 20, 2010, 11:42 AM


Search for (options) Powered by Gossamer Forum v.1.2.0

Web Applications & Managed Hosting Powered by Gossamer Threads
Visit our Mailing List Archives