Specify DLL version when using mc.exe, rc.exe and/or link.exe

Folks

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
this question?

del "test.dll"
"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
MsgFile.res MsgFile.rc
del MSG00001.bin
del MsgFile.h
del MsgFile.rc
"C:\Program Files\Microsoft Visual Studio\VB98\link" /nologo /NOENTRY
/subsystem:windows /dll /machine:I386 /out:"test.dll" MsgFile.res
del msgfile.res

Tony
-- 
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/
0
Tony
8/15/2010 3:39:27 AM
vb.general.discussion 1016 articles. 0 followers. Follow

5 Replies
1882 Views

Similar Articles

[PageSpeed] 30

On Sat, 14 Aug 2010 21:39:27 -0600, Tony Toews
<ttoews@telusplanet.net> wrote:

>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.

That should be 

creating a single entry message file DLL for 

>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
>this question?

This page  http://msdn.microsoft.com/en-us/library/ms853727.aspx might
have a lot of what I need if I can figure it out.   I'm sorta making
progress.

Tony

-- 
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/
-1
Tony
8/15/2010 5:38:09 AM
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:

HKEY_LOCAL_MACHINE\SYSTEM\CurrentControlSet\Services\Eventlog\Application\AutoFEUpdater

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 
a resource>
TypesSupported(REG_DWORD)=7

"7" in TypesSupported means support for Error, Warning, and Information 
types.

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 
your program.

As for version information, you need to add the following to the RC file, 
and change as needed:

////////////////////////////
//
// Version
//

VS_VERSION_INFO VERSIONINFO
 FILEVERSION 1,0,0,1
 PRODUCTVERSION 1,0,0,1
 FILEFLAGSMASK 0x3fL
 FILEFLAGS 0x0L
 FILEOS 0x4L
 FILETYPE 0x2L
 FILESUBTYPE 0x0L
BEGIN
    BLOCK "StringFileInfo"
    BEGIN
        BLOCK "040904b0"
        BEGIN
            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"
        END
    END
    BLOCK "VarFileInfo"
    BEGIN
        VALUE "Translation", 0x409, 1200
    END
END



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
Date:  8/15/2010
Time:  10:24:37 AM
User:  N/A
Computer: MYPC
Description:
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 
http://go.microsoft.com/fwlink/events.asp.

=================

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
Date:  8/15/2010
Time:  10:06:10 AM
User:  N/A
Computer: MYPC
Description:
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 
from VB6..

=================

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:

Message Files:
http://msdn.microsoft.com/en-us/library/aa363669%28VS.85%29.aspx

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 filename.mc

"mc" comes with the Platform SDK, and VC6, but not with VC 2003/2005/2008.


1
Nobody
8/15/2010 3:25:58 PM
On Sun, 15 Aug 2010 11:25:58 -0400, "Nobody" <nobody@nobody.com>
wrote:
  
>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:
>
>HKEY_LOCAL_MACHINE\SYSTEM\CurrentControlSet\Services\Eventlog\Application\AutoFEUpdater

Already done that.   I've got Wix working quite nicely generating an
MSI file.

>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 
>a resource>
>TypesSupported(REG_DWORD)=7
>
>"7" in TypesSupported means support for Error, Warning, and Information 
>types.

Interesting because in my testing you don't need the TypesSupported
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, 
>and change as needed:

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
there 

Tony
-- 
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/
0
Tony
8/16/2010 4:45:07 AM
"Tony Toews" <ttoews@telusplanet.net> wrote in message 
news:67gh66t9c7le78eb5g2pe0mfruo6521s6d@4ax.com...
> 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
> there

If you have VC6, then remove the changes, and open the RC file, then go to 
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:

http://en.wikipedia.org/wiki/Resource_%28Windows%29

Among the free ones, ResEdit and XN Resource Editor seem to be able to 
import RC files.


0
Nobody
8/16/2010 11:34:05 AM
On Mon, 16 Aug 2010 07:34:05 -0400, "Nobody" <nobody@nobody.com>
wrote:
  
>> 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
>> there
>
>If you have VC6, 

I do but not installed.   I'll try installing it and see if that works

>If you don't have 
>VC6, then try some of the software listed in this page:
>
>http://en.wikipedia.org/wiki/Resource_%28Windows%29
>
>Among the free ones, ResEdit and XN Resource Editor seem to be able to 
>import RC files.

So I tried ResEdit.  It put in a few slightly different lines/syntax
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
-- 
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/
0
Tony
8/18/2010 4:08:29 AM
Reply:

Similar Artilces:

How to link with an Access DB
Hi, I have an Acces DB with many tables. I need to choose the name of a customer in a cell of Excel. For example, in acces I have this tables: Table1 Id Name Last Name City I need to choose the last name from a drop down menu in a spreadsheet and then in other cell I need to put all the data regarding the last name that I choose. I hope to be exaustive, and sorry for my english. :-) Many Thanks Stefano ...

Can SUMPRODUCT be used for entire column?
This formula results in a numeric result: =SUMPRODUCT((A1:A20)*(B1:B20="b")) but this formula results in a #NUM! result: =SUMPRODUCT((A:A)*(B:B="b")) Which means I need to specify the length of the columns, which may grow over time. Any way to do this for the entire column, without having to specify the length of the column? XL07 removed the limitation on array formulas (which SUMPRODUCT is, even though it doesn't require CTRL-SHIFT-ENTER) and entire columns. For pre-XL07, one can use =SUMPRODUCT(A1:A65535, --(B1:B65536="b")) to get all but on...

How to Debug MFC dll
I have a VS 2003 soln with 2 projects - 1 MFC Dialog based app and the other MFC dll. I am loading the MFC dll from my MFC app. If I set breakpoints in the MFC dll code, it doesn't stop there. How do I debug the dll ? Regards, Amit Is the DLL linked in with the App or do you dynamically load it? AliR. "Cagespear" <Cagespear@discussions.microsoft.com> wrote in message news:C19EC4DF-2AC0-4BD3-B1C3-4C356A4EDF4C@microsoft.com... >I have a VS 2003 soln with 2 projects - 1 MFC Dialog based app and the >other > MFC dll. > > I am loading the MFC dll from my...

Table link documentation
I am having trouble trying to locate A/P check data that has project related costs. I found the check data but it is does not indicate the projects, I found the project data but can not determine thye logical link between the two tables, I may be using the wrong tables the tables I am using are PM80500 and PA31102. Is there any documentation of how all the tables in the system are logically link. I am trying to write reports in MS Access, but there are 1500+ tables in GP (version 10) -- Dave F In an effort to find the correct table you can do a number of things (believe me I do)....

Using scanner in Word97
I want to scan a picture into word97 using my HP 4370 ScanJet. Could not find option of "From Scanner" under "Insert" --> "Picture". Apparently I must need some sort of Word97 Add-On. What and where is the add-on? Is it on the Office97 CD? Same applys to Excel97. Also, does microsoft sponsor a Word97 / Office97 discussion group? If so, would appreciate a link. "PSRumbagh" <PSRumbagh@discussions.microsoft.com> said this in news item news:39100DC1-A7EE-4679-881D-526BAA386620@microsoft.com... > I want to scan a picture ...

OS version
Hi, I use GetVersionEx to check if the OS version is W95. This is the code I use: BOOL boW95 = FALSE; OSVERSIONINFOEX ovi; ZeroMemory(&ovi, sizeof(OSVERSIONINFOEX)); ovi.dwOSVersionInfoSize = sizeof(OSVERSIONINFOEX); if(!GetVersionEx((OSVERSIONINFO*)&ovi)) { ovi.dwOSVersionInfoSize = sizeof(OSVERSIONINFO); GetVersionEx((OSVERSIONINFO*)&ovi); } if(ovi.dwPlatformId = VER_PLATFORM_WIN32_WINDOWS && ovi.dwMajorVersion == 4 && ovi.dwMinorVersion == 0) { boW95 = TRUE; } I run that code and boW95 is set to TRUE on a PC with version XP. I tried on 2 machi...

Using later version of microsoft access
Hi, I've got access 2000 on my computer. When I go to open a database someone sent me I get an error message : this database is in an unrecognized format. The database may have been created with a later version of microsoft access. Is there any way I can open and use this file (short of upgrading to later version of access)? If you do not have Access 2002 or 2003, ask the person to save it in Access 2000 format for you. -- Allen Browne - Microsoft MVP. Perth, Western Australia. Tips for Access users - http://allenbrowne.com/tips.html Reply to group, rather than allenbrowne at m...

Using Company Wide Mail Templates.
Hi, I do not know if i am at the right spot here, or if it is evne possible, but i got the following question. My boss would like me to make sure that every outgoing mail has the same looks. It starts by adding a signature that is the same for everyone, except with ofcourse personalized information. This was easily done by giving everyone a signature. The next question is however, to put the head of our website, also above our mail. This means that every user that sends a mail, the mail will have a nice header, underneath that header, the mail is typed, and then its ended with the si...

Dynamic Range Selection Using VBA
What I'm trying to accomplish is to be able to run a procedure that selects a range based on a number provided in another cell. For example; if the number 10 is in cell A1, then cells A20:A30 would be selected when I run the macro. If the number 6 is provided, then cells A20:A26 would be selected. Not sure where to start, so any help is appreciated. this may do what you want range("A20").Resize(range("A1").Value+1).select -- Gary Keramidas Excel 2003 "TEK" <TEK@discussions.microsoft.com> wrote in message news:DA9FFF99-FC28-...

how create Quota filter in WIndows 2003 R2 using Script
Hi all I need create quota filter in Server 2003 R2 using vbscript. quota filter should be applied to directories and not by users. I searched information about it on google without success. thank's in advance Daniel Hi Daniel. First you need open your FSRM (File Server Resource Manager), then you create a quota template, you must specify if your quota is "software" (just monitoring, but never deny the user) or "hardaware" (deny users when they use 100% of the quota), you must specify if you want send e-mail to user when this user use...

Outlook 2003
In Outlook 2003, #1 Is there a way to refresh the unread folder so that read messages no longer apear? Right now I have to click closed the unread folder and click it again #2 Is there a way to create a toolbar button that goes directly to a subfolder? Thanks ...

Limit on Exchange 2003 version included with SBS 2003
Can anyone tell me if the version of Exchange 2003 included with Small Business Server 2003 has the 16GB limit that exists in the Exchange 2003 standard edition? Yes. >-----Original Message----- >Can anyone tell me if the version of Exchange 2003 >included with Small Business Server 2003 has the 16GB >limit that exists in the Exchange 2003 standard edition? >. > ...

Opening Multiple Web Links in a Column
Hi, I am very new to using web links in excel. A task I do very often is open a list of different websites that are in various columns in an excel spreadsheet. I am quite sure I am doing it the slowest way possible, so I need some help please. Basically I have been clicking on one link at a time. When I do this, the first website opens and excel automatically minimizes, then I have to go re maximize excel and then click the next web link and the same thing happens, etc... very time consuming. I am wondering if there is a way, either through Excel or whatever means necessary, to open all...

Using Publisher 200 with Publisher 2003
How do I covert PUB2000 documents to Pub2003 documents and vice versa? Pub 2003 can open anything, no conversion necessary. Going backward is a bit trickier. File - Save As and chance the file type to a Pub 2000 file. Possible problems can arise if you've used a feature that was not available in the 2000 version and your file size will grew immensely. -- JoAnn Paules MVP Microsoft [Publisher] "nasuco" <nasuco@discussions.microsoft.com> wrote in message news:500C7A7A-4026-434C-8CC2-2DFDB69D81C4@microsoft.com... > How do I covert PUB2000 documents to Pub2003 do...

Chart Linking
How can a cell in one workbook be linked to data in another workbook. Kenneth Hi try the following: - open both workbooks - in the target workbook enter the equatrion sign '=' - now select with your mouse the source cell in the other workbook and hit ENTER -- Regards Frank Kabel Frankfurt, Germany "Kenneth" <pby5acat@tpg.com.au> schrieb im Newsbeitrag news:40b4a089@dnews.tpgi.com.au... > How can a cell in one workbook be linked to data in another workbook. > Kenneth > > Or copy the source cell, select the target cell, choose Paste Special from the Ed...

Link Outlook 2003 to Exchange 5.5 over VPN
Hi How do you do it?? I have a VPN, I can ping the ip of the mail server (NT4) but cannot see it when I test from within Outlook 2003 exchange account Cheers Colin Put the IP address and server name of the Exchange server in your local computer's hosts file and see if you can then ping by name - if you can, you ought to be able to access the mailbox. That's just one quick way to do it....but it ought to work. Colin wrote: > Hi > > How do you do it?? I have a VPN, I can ping the ip of the > mail server (NT4) but cannot see it when I test from > within Outlook 2003 e...

Error: msaccess.exe has generated errors and will be closed by windows
Dear all, I get error mesage "msaccess.exe has generated errors and will be closed by windows" when preview report. I'm using Access 2000 and Windows 2000. Thanks. Regards, Vensia ...

How to use different return email addresses
I use outlook 98. I have a mailbox with three aliases. People sending me emails can use any of the three email aliases and the email will arrive in the same mailbox. Accessing the mailbox once will retrieve all messages regardless of which alias was used. If I reply to these emails though, I want the recipient to think that the email has come from the alias that they originally used. What outlook always seems to do is use the email address of the service that is listed first in Tools->Services->Delivery. Is there any way Outlook can be set up so when I reply to a given email, my email ...

ANN: New version of Database Workbench, the multi-DBMS IDE now available!
Ladies, gentlemen, Upscene Productions is proud to announce the next version of the popular multi-DBMS development tool: " Database Workbench 4.0 Pro" With this version we're reached a milestone: Database Workbench is now fully Unicode enabled and offers new tools to increase your productivity. There have been numerous improvements to existing tools and the user interface making it even better than before. For more information, see http://www.upscene.com/ Database Workbench supports: - Borland InterBase ( 4.x - 9.x ) - Firebird ( 1.x, 2.x ) - MS SQL...

SQL Statement trying to call column not specified in statement
I'm having some trouble with a sql statement within my sub. For some reason, it wants to reference CLPROPSTRTNMBER when I specifically asked for CLPROPSTRTNMBR (which is the correct column name). The code is below. I cannot figure out why it's trying to pull this reference. Public Sub D2REDataCall() Call DBConnect sql = "SELECT CLMAILADDRESS,CLMAILCITY,CLMAILSTATE,CLMAILZIP,CLPROPSTRTNMBR,CLPROPSTREETADDR,CLPROPSTREETUNIT,CLPROPCITY,CLPROPSTATE,CLPROPZIP,CLPROPCOUNTY,CLCREDITREPORTDT,CLRATEEFFECTIVEDT,CLCLOSEDT,CLTOTALLOANAMT,CLINTERESTRATE,CLTILAPR,CLTERM FROM " & tblC...

MS Excel: Linking spreadsheet and Absolute and Relative Paths
Our staff uses several spreadsheets, many of which are linked to SEVERAL other spreadsheets. Of course, all of these documents are stored on the network. The problem we are having is the absolute path that the link uses. Some users will access these file via (e.g.) 'S:\excel documents', while others will use 'R:\excel documents' to connect. Each time a user connects there is a 50-50 chance they will have to update the links. ** What a hassle** Is there any way to use a relative path to link spreadsheets? Using a UNC path isn't possible due to security restrictions and cha...

Save as CSV isn't saving comma delimited, but is using semi-colon.
Save as CSV isn't saving comma delimited, but is using semi-colon... How do I get it to save using commas only (,)? (I'm using semicolons for other delimitations and so can't just do a global replace.) Thanks so much for your help! Hi Excel uses your Windows regional settings for saving CSV files. Also ho should an importing program of this CSV file know whether it is the list separator or one of your other separators? -- Regards Frank Kabel Frankfurt, Germany CCinItly wrote: > Save as CSV isn't saving comma delimited, but is using semi-colon... > How do I get it ...

easy to use templates
Hi We have outlook templates that people fill in each morning and send to a distribution list. But they are not that easy to fill out as you have to place the curser in the proper spot to type then do that throughout the entire document. It is easy to overlook items. Is there a way to set up a template that you can just hit tab or enter and it automatically goes to the next area that you need to type information? -- Thank-you! Ruth What exactly are you using now? In other words, what do you mean by "templates"? Also, do you meet the prerequisites for using...

How to run ajax implemented .Net 3.5 to an old version 2.0
Hi, I have developed a Web Application in .Net 2008 and implemented <asp:UpdatePanel /> in it. But now I am trying to build it in .Net Version 2.0. But it gives an error -- "Error 1 Unknown server tag 'asp:UpdatePanel' ". I have downloaded earlier version of AjaxControlToolKit, but it does not work. What I have to do to build this code in version 2.0 Thanks and Regard Dg The UpdatePanel is not part of 2.0 or the Ajax Toolkit. This is an additional "Ajax extension for 2.0" download... Also as 3.5 is just 2.0 plus additional stuff, I wo...

MOP/SOP Links
When you link a SOP to MOP and you do a receipt on that MOP (make to order - manual) - it moves the backorder quantity on the sales order to qty to invoice. That is great, as we have specific SOPs for every MO. Problem is when we backorder, and the ticket is in backorder (since we ship partial tickets at times), and you do a receipt - that receipt is not reflected on a backorder type anywhere to specifically that order. Is this right? or does the MOP/SOP link only work for order and invoice types? Dave You can only create a link between sales order type not from Back Order type doc...