Specify DLL version when using mc.exe, rc.exe and/or link.exe
I'm creating a single entry DLL for the OS application event log so
developers and admin types don't get that ugly message when looking at
errors in the event log.
I've got the following make file which is working but I see the dll
produced does not have a version property like most DLLs and EXEs.
Any ideas on how to do such? Any better newsgroups/forums to ask
"C:\Program Files\Microsoft SDKs\Windows\v6.1\Bin\mc.exe" MsgFile.mc
"C:\Program Files\Microsoft SDKs\Windows\v6.1\Bin\rc" -r -fo
"C:\Program Files\Microsoft Visual Studio\VB98\link" /nologo /NOENTRY
/subsystem:windows /dll /machine:I386 /out:"test.dll" MsgFile.res
On Sat, 14 Aug 2010 21:39:27 -0600, Tony Toews
>I'm creating a single entry DLL for the OS application event log soThat should be
>developers and admin types don't get that ugly message when looking at
>errors in the event log.
creating a single entry message file DLL for
>I've got the following make file which is working but I see the dllThis page http://msdn.microsoft.com/en-us/library/ms853727.aspx might
>produced does not have a version property like most DLLs and EXEs.
>Any ideas on how to do such? Any better newsgroups/forums to ask
have a lot of what I need if I can figure it out. I'm sorta making
First, 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: 4560 ,Logged: Message from VB6.
For more information, see Help and Support Center at
If you try to use the API directly by calling ReportEvent() function without
making the messages DLL, this is what appears in Event Viewer:
Event Type: Information
Event Source: MyEventSource
Event Category: None
Event ID: 100
Time: 10:06:10 AM
The description for Event ID ( 100 ) in Source ( MyEventSource ) cannot be
found. The local computer may not have the necessary registry information or
message DLL files to display messages from a remote computer. You may be
able to use the /AUXSOURCE= flag to retrieve this description; see Help and
Support for details. The following information is part of the event: Message
Note how the message that you actually written appears at the end of the
description. If you specify the DLL for Event Viewer, only what you provided
appears there. Some link about what message files are:
Once you made your text message file, you use the following command to turn
it into a BIN file that is ready to be included as a resource:
"mc" comes with the Platform SDK, and VC6, but not with VC 2003/2005/2008.
On Sun, 15 Aug 2010 11:25:58 -0400, "Nobody" <email@example.com>Already done that. I've got Wix working quite nicely generating an
>First, 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:Interesting because in my testing you don't need the TypesSupported
>EventMessageFile(REG_SZ)=<Full path to DLL or EXE with MSG00001.bin added as
>"7" in TypesSupported means support for Error, Warning, and Information
registry key. You do need the EventMessageFile registry key.
Side note. The users don't need the above DLL or registry key to
record the entries. The folks, such as the developers or admins, who
view the event log do need the DLL and registry key.
>As for version information, you need to add the following to the RC file,I added what you specified and I still can't see the version info tab
>and change as needed:
when I right click on the DLL. I doubled checked the .res and the
..dll file produced using Notepad and the information specified was in
"Tony Toews" <firstname.lastname@example.org> wrote in messageIf you have VC6, then remove the changes, and open the RC file, then go to
> I added what you specified and I still can't see the version info tab
> when I right click on the DLL. I doubled checked the .res and the
> .dll file produced using Notepad and the information specified was in
Insert-->Resource-->Version, and just type the information. Unfortunately,
you can't edit RC files in the express versions of VC. If you don't have
VC6, then try some of the software listed in this page:
Among the free ones, ResEdit and XN Resource Editor seem to be able to
import RC files.
On Mon, 16 Aug 2010 07:34:05 -0400, "Nobody" <email@example.com>I do but not installed. I'll try installing it and see if that works
>> I added what you specified and I still can't see the version info tab
>> when I right click on the DLL. I doubled checked the .res and the
>> .dll file produced using Notepad and the information specified was in
>If you have VC6,
>If you don't haveSo I tried ResEdit. It put in a few slightly different lines/syntax
>VC6, then try some of the software listed in this page:
>Among the free ones, ResEdit and XN Resource Editor seem to be able to
>import RC files.
than you have along with all kinds of external variables. So I tried
importing the various .h files required from the SDK folder until it
complained about a file called sal.h. Which might be in the VC folder
that I'll install later.
So then I tried taking the ResEdit file it produced and replacing the
constants with the values from your file. Compiled cleanly but still
no version properties.
I then tried the XN Resource Editor which inserted the data directly
into into a RES file rather than the RC file. I then ran the Link
and still no version number when I right clicked the DLL.
Tony Toews, Microsoft Access MVP
Tony's Main MS Access pages - http://www.granite.ab.ca/accsmstr.htm
Tony's Microsoft Access Blog - http://msmvps.com/blogs/access/
For a convenient utility to keep your users FEs and other files
updated see http://www.autofeupdater.com/