hi guys,
I want to develop an application that logs the Internet Explorer (IE) usage time and the person who use it.
to do this, i need the application to runs or popup the login interface when user open the IE. when user closes all the IE windows, then the application will logout itself and at the same time logs the usage time.
how can i do this??
thanks..
Loading
AlanPosted Sep 9, 2007, 7:31 PM
The only way I can think of doing this is to write a batch file which does the following:
1. Runs your program which pops up the login dialog. If the login is successful, your program logs the start time to a file and exits returning 0 to the operating system (you'll need to use the version of Main() which returns an int for this. If the login is unsuccesful, then the program exits and returns 1 to the operating system.
2. If the 'errorlevel' environment variable is 1, the batch file exits without running IE otherwise IE is started.
3. When IE exits, the batch file runs another small program (or a version of the original program with a different command line argument) which logs the finish time to the file and then exits.
So, you'd need a batch file something like this:
@echo off
myprog
if %errorlevel% == 1 goto :EOF
c:\windows\ie7\iexplore
myprog2
If you call this iexplore.bat and hide it, you can then change the user's desktop shortcuts etc. to run the .bat file rather than the .exe. I'd also hide your own programs so that they cannot easily be tracked down and deleted.
Of course, this will only work if your users are relatively unsophisticated :)
The time interval logged will also be slightly too great because of the time needed by the OS to unload one app and start up the next but this may not matter too much.
On the other hand it won't prevent automatic update programs and the like from starting IE without a password, assuming you don't want to log that as well.