General information
Category:
Windows API functions
Title:
MessageFormat unable to find resource in module
Hi all
I'm writing a VB6 program to monitor NT event logs from a central location. So far I've got the event records, got the event ID and source, found the module name from the registry, and loaded it with LoadLibraryEx. I find the EventMessageFile from the registry and load it with LoadLibraryEx and get a handle OK, but then when I use FormatMessage it returns zero and Err.LastDLLError is 1812, saying that the image does not contain a resource section.
The code looks like this:
lngSize = 2000&
strTemp = String(lngSize, 0)
lngFlags = FORMAT_MESSAGE_FROM_HMODULE Or FORMAT_MESSAGE_IGNORE_INSERTS Or FORMAT_MESSAGE_FROM_SYSTEM
lngLen = FormatMessage(lngFlags, hMsgFile, lngEventID, &H400&, strTemp, 2000&, ByVal 0&)
where...
lngFlags = &H1A00
hMsgFile = big non-zero number (file is IOLogMsg.DLL)
lngEventID = 7
I have messed about with different parameters, but without success. Does anyone have experience of doing this and making it work?
Regards
Neil
Reply
View the map of this thread
View the map of this thread starting from this message only
View all messages of this thread
View all messages of this thread starting from this message only