Well looking at your code I think you got the params for FormatMessage slightly wrong. Try changing it to
void CEllepsisDlg::Log(CString x,...)
{
TCHAR fprmatedMessage[2048];
va_list marker;
va_start( marker, x );
FormatMessage(FORMAT_MESSAGE_FROM_STRING, (LPCVOID)((LPCTSTR)x), NULL, NULL,
fprmatedMessage, sizeof(fprmatedMessage), marker);
va_end( marker );
}
I havn't tested it, but I think that might work better. [EDIT]Be aware that in this new scheme that i've created, nothing happens to fprmatedMessage when FormatMessage has finished. Make sure you copy the string into a CString before using outside the Log function, otherwise your program will crash. e.g.
CString myresult = fprmatedMessage;
If you only want to use it within the function, then you can use fprmatedMessage just like any LPTSTR.[/EDIT] Hope this helps. Joel Holdsworth Wanna give me a job this summer? Check out my online CV and project history[^]