今天看了《用 C++ 創建簡單的 Win32 服務程序》一文,裏面提到了將服務的運行的狀態寫到日誌裏,這時就要自己生成一個消息表,將這些消息放到程序裏,用ReportEvent就能將記錄寫到日誌裏,文章裏給出了具體方法,但是其中有個步驟是: |
MessageId=100
SymbolicName=EVMSG_INSTALLED
Language=English
The %1 service was installed.
.
SymbolicName=EVMSG_REMOVED
Language=English
The %1 service was removed.
.
SymbolicName=EVMSG_NOTREMOVED
Language=English
The %1 service could not be removed.
.
SymbolicName=EVMSG_CTRLHANDLERNOTINSTALLED
Language=English
The control handler could not be installed.
.
SymbolicName=EVMSG_FAILEDINIT
Language=English
The initialization process failed.
.
SymbolicName=EVMSG_STARTED
Language=English
The service was started.
.
SymbolicName=EVMSG_BADREQUEST
Language=English
The service received an unsupported request.
.
SymbolicName=EVMSG_DEBUG
Language=English
Debug: %1
.
SymbolicName=EVMSG_STOPPED
Language=English
The service was stopped.
.
Using MC (The MC Command Line)
The message compiler has the following command-line syntax.
MC [-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/2 MKMSGF utility. These are any escape sequences other than %0 and %n. This option is useful for converting MKMSGF message files to MC 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 .rc extension.
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 each LanguageId statement, the message compiler generates a binary file containing a message table resource. It also generates a single resource script file that contains the appropriate resource compiler statements to include each binary output file as a resource with the appropriate symbolic name and language type.