AllAPI Network - The KPD-Team

 
Allapi Network
 API-Guide
 ApiViewer

 API List

 
API Resources
 Tips & Tricks
 VB Tutorials
 Error Lookup
 
Misc Stuff
 VB examples
 VB Tools
 VB Links
 Top Downloads
 
This Site
 Search Engine
 Contact Form
 

Donate to AllAPI.net

Logging use of executables in Windows

This handy little tip can be used to log the use of .exe, .lnk, .pif, .bat, and .com files on your computer. All it needs is a little registry tinkering. Place this code in a module, and set the project startup object to 'Sub Main'

Procedure

Sub Main()
If Command$ <> "" Then
Open "c:\apps\exelog.txt" For Append As #1
Print #1, Command$ & " " & CStr(Now)
Close #1
Call Shell(Command$, vbNormalFocus)
End If
End
End Sub

Registry Changes

The registry changes are:

HKEY_CLASSES_ROOT\exefile\shell\open\command to: "C:\exewrap.exe" "%1" %*
HKEY_CLASSES_ROOT\lnkfile\shell\open\command to: "C:\exewrap.exe" "%1" %*
HKEY_CLASSES_ROOT\piffile\shell\open\command to: "C:\exewrap.exe" "%1" %*
HKEY_CLASSES_ROOT\batfile\shell\open\command to: "C:\exewrap.exe" "%1" %*
HKEY_CLASSES_ROOT\comfile\shell\open\command to: "C:\exewrap.exe" "%1" %*

What happens it that instead of running the program directly, Windows calls our program, which logs filename and time, and then calls the program.

 

 


Copyright © 1998-2007, The Mentalis.org Team - Privacy statement
Did you find a bug on this page? Tell us!
This site is located at http://allapi.mentalis.org/