Logging use of executable in Windows

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'
One of my old tricks that did not get time to test in all Windows yet, tested in WinMe


Public

Not Tested

Not My Work
' 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:\appsexelog.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\piffileshell\open\command to: "C:\exewrap.exe" "%1" %*
' HKEY_CLASSES_ROOT\batfile\shell\open\command to: "C:\exewrap.exe" "%1" %*
' HKEY_CLASSES_ROOT\com\file\shell\open\command to: "C:\exewrap.exe" "%1" %*

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

Views 225 Downloads 39

Windows + Registry Sessions
ANmarAmdeen
806
Attachments
Revisions

v2.0