tomkear2006
October 11th, 2009, 02:44 PM
I am having some embarrassing problems that I can't get my head around. I expect many people here will be able to help with this one.
I want a message box to output a variables content, but I am running into difficulties. My code basically goes something like this:
int iErrorCode = GetLastError();
char szErrorText[256];
ZeroMemory(szErrorText, sizeof(szErrorText));
sprintf(szErrorText, "Error Code Returned: %d", iErrorCode);
int iMessageReturn = MessageBox(NULL,
szErrorText,
L"Title of the box!",
MB_ICONERROR | MB_RETRYCANCEL);
I think this is something to do with the unicode setting but I don't know how to rectify. Can someone please help by telling me how I can convert the char variable into a LPCWSTR that the MessageBox() function won't moan about?
Thanks,
Tom
I want a message box to output a variables content, but I am running into difficulties. My code basically goes something like this:
int iErrorCode = GetLastError();
char szErrorText[256];
ZeroMemory(szErrorText, sizeof(szErrorText));
sprintf(szErrorText, "Error Code Returned: %d", iErrorCode);
int iMessageReturn = MessageBox(NULL,
szErrorText,
L"Title of the box!",
MB_ICONERROR | MB_RETRYCANCEL);
I think this is something to do with the unicode setting but I don't know how to rectify. Can someone please help by telling me how I can convert the char variable into a LPCWSTR that the MessageBox() function won't moan about?
Thanks,
Tom