How to display DWORD in message box ?

hi... i'm newbie here
i try to display DWORD to message box.
The problems are i don't use MFC and i cannot find afx.h file
i use embedded visual c++ , and develop WIN32 Application.

These are the codes

inline void GetCRC32::OnPrint(DWORD dwCrc32, DWORD dwErrorCode)
{
CString strResult ;

if(dwErrorCode == NO_ERROR)
{
strResult.Format(TEXT("0x%08x"),dwCrc32);
MessageBox(NULL, strResult, TEXT("CRC value"), MB_OK) ;
return;
}
strResult.Format(TEXT("0x%08x"), dwErrorCode) ;
MessageBox(NULL, strResult, TEXT("Error"), MB_OK) ;
}
and the header Files:
#include "stdafx.h"
#include "GetCRC32.h"
#include <string.h>

but it gives error :
error C2065: 'CString' : undeclared identifier
error C2146: syntax error : missing ';' before identifier 'strResult'
error C2065: 'strResult' : undeclared identifier
error C2228: left of '.Format' must have class/struct/union type
error C2228: left of '.Format' must have class/struct/union type

Can anyone tell me instead of using CString ?
i use custom SDK performed by my company instead of standard SDK.

Thanks
[1331 byte] By [farizadp] at [2007-11-20 1:35:04]
# 1 Re: How to display DWORD in message box ?
You can use sprintf function to get the number in a string.

char szMyString[10] ={0}; // Have enough storage in character array.
sprintf(szMyString, "0x%08x",dwCrc32);
MessageBox(NULL, szMyString, TEXT("CRC value"), MB_OK) ;
Krishnaa at 2007-11-10 23:17:57 >
# 2 Re: How to display DWORD in message box ?
but then it gave error

error C2664: 'MessageBoxW' : cannot convert parameter 2 from 'char [10]' to 'const unsigned short *'

looks like the messagebox cannot read the second parameter
farizadp at 2007-11-10 23:19:02 >
# 3 Re: How to display DWORD in message box ?
Call the UNICODE version of sprintf: swprintf, or better to allow compile in both UNICODE and non-UNICODE configurations, use _stprintf macro.
Also put TCHAR instead of char and use _T (or TEXT) for string constants ,e.g. _T("0x%08x").
ovidiucucu at 2007-11-10 23:20:01 >
# 4 Re: How to display DWORD in message box ?
Call the UNICODE version of sprintf: swprintf, or better to allow compile in both UNICODE and non-UNICODE configurations, use ]_stprintf[/COLOR] macro.
Also put TCHAR instead of char and use _T (or TEXT) for string constants (e.g. _T("0x%08x").
it works !!
i use TCHAR and TEXT("0x%08x")
with _stprintf

thanks a lot !!
farizadp at 2007-11-10 23:21:06 >