2023年7月3日发(作者:)
VC⾃带的的使⽤今天看了《⽤ C++ 创建简单的 Win32 服务程序》⼀⽂,⾥⾯提到了将服务的运⾏的状态写到⽇志⾥,这时就要⾃⼰⽣成⼀个消息表,将这些消息放到程序⾥,⽤ReportEvent就能将记录写到⽇志⾥,⽂章⾥给出了具体⽅法,但是其中有个步骤是:⽤VC⾃带的 编译⼀个*.mc⽂件,⽣成*.h,*.rc,*.bin查了下资料后⾃⼰成功编译了⼀个.mc⽂件,具体操作如下:1、创建.mc⽂件.mc的格式是这样的:MessageId=100SymbolicName=EVMSG_INSTALLEDLanguage=EnglishThe %1 service was installed..MessageId=SymbolicName=EVMSG_REMOVEDLanguage=EnglishThe %1 service was removed..MessageId=SymbolicName=EVMSG_NOTREMOVEDLanguage=EnglishThe %1 service could not be removed..MessageId=SymbolicName=EVMSG_CTRLHANDLERNOTINSTALLEDLanguage=EnglishThe control handler could not be installed..MessageId=SymbolicName=EVMSG_FAILEDINITLanguage=EnglishThe initialization process failed..MessageId=SymbolicName=EVMSG_STARTEDLanguage=EnglishThe service was started..MessageId=SymbolicName=EVMSG_BADREQUESTLanguage=EnglishThe service received an unsupported request..MessageId=SymbolicName=EVMSG_DEBUGLanguage=EnglishDebug: %eId=SymbolicName=EVMSG_STOPPEDLanguage=EnglishThe service was stopped..2 、了解的命令先看下下⾯的描述:Using MC (The MC Command Line)The message compiler has the following command-line [-v] [-w] [-s] [-d] [-h dir] [-e extension] [-r dir] filename[.mc]-v
Generates verbose output to stderr. -w
Generates a warning message whenever an insert escape sequence is seen that is a superset of the type supported by the OS/2MKMSGF utility. These are any escape sequences other than %0 and %n. This option is useful for converting MKMSGF message files toMC format.
-s
Adds an extra line to the beginning of each message that is the symbolic name associated with the message identifier.
-d
Outputs Severity and Facility constants in decimal. Sets the initial output radix for messages to decimal.
-hdirs
Target directory of the generated include file. The include-file name is the base name of the .mc file with a .h extension.
-eextension
Extension for the header file, which can be from one to three characters. The default is .h.
-rdir
Target directory of the generated resource compiler script (.rc file). The script file name is the base name of the .mc file with a .rcextension.
filename[.MC]
Input message file that is compiled into one or more binary resource files, one for each language specified in the message file.
The message compiler reads the message file and generates a C/C++ include file containing definitions for the symbolic names. For eachLanguageId statement, the message compiler generates a binary file containing a message table resource. It also generates a singleresource script file that contains the appropriate resource compiler statements to include each binary output file as a resource with theappropriate symbolic name and language type.最后根据这个说明我们知道应该⽤-v, -h,-r 这⼏个命令。3、编译我的编译步骤 “开始”-“运⾏” - 'cmd',在命令⾏下输⼊mc -v -h c:test -r c:test c:前提是你在c:test⽬录下有个编辑好的 ⽂件,编译后到c:test⽬录下看看,具体每个命令的含义应该就⼀⽬了然了。
发布者:admin,转转请注明出处:http://www.yc00.com/xiaochengxu/1688382582a129677.html
评论列表(0条)