|
-
July 29th, 1999, 03:55 PM
#1
Memory leak?
Hi all,
I need to use FormatMessage function in my program and i call it like this:
FormatMessage(FORMAT_MESSAGE_ALLOCATE_BUFFER|
FORMAT_MESSAGE_FROM_HMODULE,
Model, // Handle of the dll file
EventID,
MAKELANGID(LANG_NEUTRAL, SUBLANG_DEFAULT),
(LPTSTR) lpMessage, // array of char[2048]
2048,
(char**) strInsert);
However, there is runtime error when executing this function (program halt) and I think there may be problem for the last parameter. It is the array of string char[30][512]. I don't know if the mapping works or not. Anyone can tell me how to add insertion string to the message when using FormatMessage?
Thank a lot
Herman Lee
-
July 29th, 1999, 04:10 PM
#2
Re: Memory leak?
The last parameter must be a pointer to a va_list (see stdarg.h or vararg.h and how C handles varing number of parameters), or it must be an array of 32-bit values. If it is an array of unsigned longs, the FORMAT_MESSAGE_ARGUMENT_ARRAY flag must be specified.
All of this info is in the on-line help.
Regards,
Paul McKenzie
Posting Permissions
- You may not post new threads
- You may not post replies
- You may not post attachments
- You may not edit your posts
-
Forum Rules
|
Click Here to Expand Forum to Full Width
|