Help with Message Script (.mc) files 
Author Message
 Help with Message Script (.mc) files

I'm trying to learn how to post messages to the NT Event Log correctly.  I'm
creating the events fine, but I'm not sure how to use the message resource.

In VC++, I have a workspace with 4 projects.  These 4 projects resolve to 4
different DLLs, which are used by another application.  I'd like to add a
message resource that is shared among these 4 projects so they can all use
them to post events to the NT Event Log.  I don't see a way to do that.
Where should the .mc file go?  The information in the help is leaving me
with some gaps in this process, so any general pointers to message scripts
would be helpful, thanks.



Mon, 15 Dec 2003 05:52:27 GMT  
 Help with Message Script (.mc) files
create a new empy project.  add the mc file and under custom build put all
the build steps you use for the MC/resource dll generation

then just have everything point to that dll and .h

marc


Quote:
> I'm trying to learn how to post messages to the NT Event Log correctly.
I'm
> creating the events fine, but I'm not sure how to use the message
resource.

> In VC++, I have a workspace with 4 projects.  These 4 projects resolve to
4
> different DLLs, which are used by another application.  I'd like to add a
> message resource that is shared among these 4 projects so they can all use
> them to post events to the NT Event Log.  I don't see a way to do that.
> Where should the .mc file go?  The information in the help is leaving me
> with some gaps in this process, so any general pointers to message scripts
> would be helpful, thanks.



Mon, 15 Dec 2003 20:30:23 GMT  
 Help with Message Script (.mc) files
For now I'm trying it in the same project just to get it to work.  Further
help on the basics appreciated.

I've created an .mc file and updated the custom build in the project
settings.  When the project builds, I get the .h, .rc, and .bin files as I
would expect.

problem 1) there are no new entries on my Resource tab which I would have
expected.  How do I get them there?

In my code I include the .h file and can issue the message ID to the Event
Log.  I have registered the project DLL (which should now include the
messages) in the registry, including the EventMessageFile and TypesSupported
values.

When I run the app, a function in my DLL is called and an event is issued to
the Event Log.  It has the correct Event ID that I specified for that msg in
my .mc file.  However, it still says it can't locate the message source.
Any pointers here?  Thanks,
Jeff



Tue, 16 Dec 2003 06:18:19 GMT  
 Help with Message Script (.mc) files
the EventMessageFile needs to be a full path, i.e. D:\Program
Files\MyStuff\MyDll.dll

the only way I ever handle events is to compile a separate resource DLL, so
the way your attempting to do it is foreign to me.

I create a project just for the event dll, compile the dll using custom
build steps, and in the build steps copy the .h that is created to the
include directory for my other projects, and the dll to a known location.

then have the other projects register themselves in the registry w/
eventmessagefile pointing to the above known location.  if you are using
installshield or something along those lines, you will need to have IT
register the EventSources since only it will know where the dll is going if
your allow that to be customized.

the resource only dll is the ideal way to go, its simple, and if multiple
projects use the same error messages its more efficient in the long run.

marc


Quote:
> For now I'm trying it in the same project just to get it to work.  Further
> help on the basics appreciated.

> I've created an .mc file and updated the custom build in the project
> settings.  When the project builds, I get the .h, .rc, and .bin files as I
> would expect.

> problem 1) there are no new entries on my Resource tab which I would have
> expected.  How do I get them there?

> In my code I include the .h file and can issue the message ID to the Event
> Log.  I have registered the project DLL (which should now include the
> messages) in the registry, including the EventMessageFile and
TypesSupported
> values.

> When I run the app, a function in my DLL is called and an event is issued
to
> the Event Log.  It has the correct Event ID that I specified for that msg
in
> my .mc file.  However, it still says it can't locate the message source.
> Any pointers here?  Thanks,
> Jeff



Tue, 16 Dec 2003 20:48:30 GMT  
 
 [ 4 post ] 

 Relevant Pages 

1. format mc file message text

2. MC Message file

3. Message Compiler (MC) and Event Logging (NT)

4. How to add mc file to project

5. Adding .MC file to VC 5.0 project

6. Two file sort script Help...

7. How to make message table (.mc file) work with VC++?

8. More on Active Script and Window Script Control

9. Help Context for Message Text Files

10. Looking for prog/script to find all function prototypes in *.h,*.c files

11. fopen error in script (corrected 4. file)

12. Executing an Sql Script file using c#

 

 
Powered by phpBB® Forum Software