Who knows how to use the mc.exe (Message Compiler)?
Asked Answered
K

4

6

I am trying to use the mc.exe to make message files for my event log writing program. But even the sample message file provided by the Microsoft won't compile. Who knows how to write a message file that could be compiled by mc.exe?

EDIT: The error message I got is :

msgs.mc(1) : error : expected keyword
- ??

Edit 2: Problem solved. The mc.exe can only support Unicode or ANSI encoded source file. My file is encoded as UTF8. That's it.

Thanks.

Kalvin answered 23/7, 2010 at 7:23 Comment(2)
Please close this case since I have solved it. Thanks, dear moderator.Kalvin
Yeah, questions don't get closed when the problem is solved, they get answered. And then they stay open forever, still marked as answered so that others can see the problem and the solution. That's how the site works. Just letting you know.Sciuroid
K
6

Problem solved. The mc.exe can only support Unicode or ANSI encoded source file. My file is encoded as UTF8. That's it.

Thanks guys.

Kalvin answered 6/8, 2010 at 1:57 Comment(3)
By the way, where is the mc.exe file anyway? Is it in the WDK only?Ahmad
@SaherAhwal Sorry Saher, it's been a long time and I really can't recall that. You can try some desktop search tool for that. Such as Everything or Agent Ransack. Both free.Kalvin
no worries, it's funny my comment is 2 years old I can't remember why I needed this...lolAhmad
M
6

Always document the error message you get

Being forced to guess: if you get an error in line #82, complaining about an invalid character (0x2e), then open the file in a text editor, put the cursor after the . and press Enter so the line is terminated with a line feed.

Melodrama answered 23/7, 2010 at 10:4 Comment(1)
I wish I could upvote this a million times. This has got to be the worst documented tool MS has ever come up with. SO to the rescue again.Diegodiehard
K
6

Problem solved. The mc.exe can only support Unicode or ANSI encoded source file. My file is encoded as UTF8. That's it.

Thanks guys.

Kalvin answered 6/8, 2010 at 1:57 Comment(3)
By the way, where is the mc.exe file anyway? Is it in the WDK only?Ahmad
@SaherAhwal Sorry Saher, it's been a long time and I really can't recall that. You can try some desktop search tool for that. Such as Everything or Agent Ransack. Both free.Kalvin
no worries, it's funny my comment is 2 years old I can't remember why I needed this...lolAhmad
W
2

The sample works for me in Visual Studio 2008 or 2010. How about posting your msgs.mc file.

Also did you save as plain ascii? Maybe the encoding header is confusing it...

Wollongong answered 26/7, 2010 at 9:37 Comment(0)
C
0

Here I traying to explains how to integrate mc.exe into the Visual Studio build environment by VS Developer command line example.

The Message file will need to be compiled as follows from the Visual Studio Developer Comand line :

  1. mc -v MyWebService.mc
  2. rc -r -fo MyWebService.res MyWebService.rc
  3. link -dll -noentry -out:MyWebServiceEvtID.dll MyWebService.res /MACHINE:X86

Also, ensure the MyWebServiceEvtID.dll is copied to C:\inetpub\wwwroot\MyWebServices\\bin

Finally, make sure that the registry contains an entry as follows :

[HKEY_LOCAL_MACHINE\SYSTEM\CurrentControlSet\services\eventlog\Application<Project>.MyWebService] "EventMessageFile"="C:\inetpub\wwwroot\MyWebServices\\bin\MyWebServiceEvtID.dll"

The above entries can be copied to a .reg file and executed using the regedit tool

Cutaneous answered 21/12, 2023 at 15:14 Comment(0)

© 2022 - 2025 — McMap. All rights reserved.