irst, in order to provide the DLL to Event Viewer so the messages look like
what you want, you need to add a subkey and values to HKLM, and a limited
user can't write to it, so this need to be added in an installer. Here is
the subkey that you need to add:
And you need to add 2 values in the subkey above:
EventMessageFile(REG_SZ)=<Full path to DLL or EXE with MSG00001.bin added as
"7" in TypesSupported means support for Error, Warning, and Information
So to use a custom DLL, you need to add the values above first. Your users'
admins probably could do that if they use PsExec to run RegEdit silently and
remotely. They can also do it from RegEdit-->File-->Connect to Network
Registry, and specify the remote computer name to see its registry. You can
also do it in VB by calling RegConnectRegistry() and specify the computer
name. Randy Birch site has code to list computers in a domain, so it can be
done from your software, however, that function would return
ERROR_ACCESS_DENIED(5) if the user didn't use "Run as Administrator" to run
As for version information, you need to add the following to the RC file,
and change as needed:
VALUE "Comments", "\0"
VALUE "CompanyName", "My Company\0"
VALUE "FileDescription", "Auto FE Updater Event Log Messages\0"
VALUE "FileVersion", "1, 0, 0, 1\0"
VALUE "InternalName", "AutoFEUpdater\0"
VALUE "LegalCopyright", "\0"
VALUE "LegalTrademarks", "\0"
VALUE "OriginalFilename", "AutoFEUpdaterLog.dll\0"
VALUE "PrivateBuild", "\0"
VALUE "ProductName", "Auto FE Updater Event Log Messages\0"
VALUE "ProductVersion", "1, 0, 0, 1\0"
VALUE "SpecialBuild", "\0"
VALUE "Translation", 0x409, 1200
Change FILEVERSION and PRODUCTVERSION, including in the block that lists
VALUE's to what you want. The way you are doing it is not the only way, you
can make the DLL in VB. Compile "mc" file into "bin" file as usual but
without the version resource, as VB adds that for you, then add MSG00001.bin
as a resource to your project using "Visual Basic 6 Resource Editor" Add-in.
You can add it to your EXE, but if Event Viewer is open, it maybe keeping
the file loaded, so it would be difficult to replace.
For those curious what the OP is talking about, when you use the following
line of code in VB:
App.LogEvent "Message from VB6.", vbLogEventTypeInformation
The event source in Event Viewer shows "VBRuntime", and here is what is
logged(The URL is also added by the VB runtime, and not by the OS):
Event Type: Information
Event Source: VBRuntime
Event Category: None
Event ID: 1
Time: 10:24:37 AM
The VB Application identified by the event source logged this Application
Project1: Thread ID: 4