As the message says, you're probably missing a message dll and/or registry entries. You first have to create a message file as indicated below
Code:
MessageId=20515
SymbolicName=WAIT_Q_FILLING
Language=English
%1
We'll call the above help.mc.
Next, you will have to run the message compiler on help.mc as follows:
This will create a help.h and a help.rc file
Now, we'll run the resource compiler as follows on the help.rc file
Code:
rc -r -fo help.res help.rc
Now, we'll have to create a help.dll as follows:
Code:
link -dll -noentry -out:help.dll help.res
Then copy this help.dll to %SystemRoot%\System folder
Next we have to "install" the message using the following code. We are assuming the name of your app is MYPROGRAM
Code:
#pragma comment( lib, "advapi32.lib" )
#include <windows.h>
#include <stdio.h>
BOOL Install(void)
{
HKEY hk;
DWORD dwDisposition, dwAllowed;
char szName[256] = {0};
strcpy(szName,"SYSTEM\\CurrentControlSet\\Services\\Eventlog\\Application\\");
strcat(szName,"MYPROGRAM");
if (RegCreateKeyEx(HKEY_LOCAL_MACHINE,szName, 0,NULL,REG_OPTION_NON_VOLATILE,KEY_ALL_ACCESS,
NULL,&hk,&dwDisposition))
{
printf("Unable to create registry key");
return FALSE;
}
strcpy (szName,"%SystemRoot%\\System\\HELP.DLL");
if(RegSetValueEx(hk,"EventMessageFile",0,REG_EXPAND_SZ,(LPBYTE)szName,strlen(szName)+1))
{
printf("Unable to create/set registry value (message DLL name)");
return FALSE;
}
dwAllowed=EVENTLOG_ERROR_TYPE |EVENTLOG_WARNING_TYPE | EVENTLOG_INFORMATION_TYPE;
if (RegSetValueEx(hk,"TypesSupported",0,REG_DWORD,
(LPBYTE)&dwAllowed,sizeof(DWORD)))
{
printf("Unable to create/set registry value (message types)");
return FALSE;
}
RegCloseKey(hk);
return TRUE;
}
int main(void)
{
Install();
return 0;
}
Finally, include the help.h in your source code.