Read logoff and logon times for windows with delphi

Where do I find the log file which logs windows xp lonon and logoff times.
How can I read the file using delphi code
LVL 1
hush021299Asked:
Who is Participating?
I wear a lot of hats...

"The solutions and answers provided on Experts Exchange have been extremely helpful to me over the last few years. I wear a lot of hats - Developer, Database Administrator, Help Desk, etc., so I know a lot of things but not a lot about one thing. Experts Exchange gives me answers from people who do know a lot about one thing, in a easy to use platform." -Todd S.

hush021299Author Commented:
Changed failure in the head line
0
ziolkoCommented:
you can find it in system log (Security).
with delphi you can do this with:
OpenEventLog() and ReadEventLog() functions.

If there will be no one with ready code I'll post some here later this evening.

ziolko.
0
ziolkoCommented:
check out inthe's solution:
http://www.experts-exchange.com/Programming/Languages/Pascal/Delphi/Q_20095952.html

just change 'Application' to 'Security' you will also have to browse for logon/logoff event log entries

ziolko.
0

Experts Exchange Solution brought to you by

Your issues matter to us.

Facing a tech roadblock? Get the help and guidance you need from experienced professionals who care. Ask your question anytime, anywhere, with no hassle.

Start your 7-day free trial
Get expert help—faster!

Need expert help—fast? Use the Help Bell for personalized assistance getting answers to your important questions.

Steven-FernandezCommented:
Or a simple idea.

Create a small application that will start on windows startup (for example: put a shortcut in the start menu to start it automatically or via the registry).

The application can start and minimize to the try.

Everytime the application starts save the date and time on a file on a specified location of your choice.

Then inside a timer you can try something like this to detect windows shutdown:

http://www.experts-exchange.com/Programming/Languages/Pascal/Delphi/Q_10305197.html?sfQueryTermInfo=1+detect+shutdown

When detected that add this entry date and time to your file.

This is a very simple way to do it and you will have a log of all logins and shutdowns and you can even add the username to the log.  

0
hush021299Author Commented:
Thanks I will check that.
The Idea from Stecenz is already implemented in an old program of mine: WinExit
But often the shutdown is "incontroled", sometimes I start with hibernated machine
so I search for windows log
0
hush021299Author Commented:
I failed early
in windows/security/log there is no system.log
0
ziolkoCommented:
>>in windows/security/log there is no system.log

nope there's no system.log but there is \Windows\System32\config\SecEvent.evt

but you won't be anle to read directly form file use inthe's solution from link I posted to read from system log not from file on disk

ziolko.
0
hush021299Author Commented:
I will try this one
0
It's more than this solution.Get answers and train to solve all your tech problems - anytime, anywhere.Try it for free Edge Out The Competitionfor your dream job with proven skills and certifications.Get started today Stand Outas the employee with proven skills.Start learning today for free Move Your Career Forwardwith certification training in the latest technologies.Start your trial today
Delphi

From novice to tech pro — start learning today.