DWORD to BSTR
-
What is the easiest way to append a DWORD (the result from GetTickCount in this case) to a BSTR, the following works but I know there must be an easier way: CComBSTR szString = ""; char szStartTime[11] = ""; sprintf( szStartTime, "%ul", GetTickCount() ); szString.AppendBSTR( szSessionID ); szString.AppendBSTR( szSep ); szString.AppendBSTR( szIPAddress ); szString.AppendBSTR( szSep ); szString.Append( szStartTime ); And the following doesn't work (much to my dismay): CComBSTR szString = ""; DWORD dwStartTime = GetTickCount(); szString.AppendBSTR( szSessionID ); szString.AppendBSTR( szSep ); szString.AppendBSTR( szIPAddress ); szString.AppendBSTR( szSep ); szString.Append( dwStartTime ); I also tried casting the DWORD as different types but none of this worked. Any suggestions. Thanks. :(
-
What is the easiest way to append a DWORD (the result from GetTickCount in this case) to a BSTR, the following works but I know there must be an easier way: CComBSTR szString = ""; char szStartTime[11] = ""; sprintf( szStartTime, "%ul", GetTickCount() ); szString.AppendBSTR( szSessionID ); szString.AppendBSTR( szSep ); szString.AppendBSTR( szIPAddress ); szString.AppendBSTR( szSep ); szString.Append( szStartTime ); And the following doesn't work (much to my dismay): CComBSTR szString = ""; DWORD dwStartTime = GetTickCount(); szString.AppendBSTR( szSessionID ); szString.AppendBSTR( szSep ); szString.AppendBSTR( szIPAddress ); szString.AppendBSTR( szSep ); szString.Append( dwStartTime ); I also tried casting the DWORD as different types but none of this worked. Any suggestions. Thanks. :(
Hi ! May be it's the one you'was looking for? #include using namespace std; sstringstream ss; ss << LPCSTR(szSessionID) << LPCSTR(szSep) << LPCSTR(szIPAddress)\ LPCSTR(szSep) << ULONG(::GetTickCount()); CComBSTR szString(ss.str().c_str()); Best regards, ----------- Igor Soukhov (Brainbench/Tekmetrics ID:50759) igor_soukhov@mailru.com | ICQ:57404554 | http://siv.da.ru