Board index » cppbuilder » wsprintfW error

wsprintfW error


2007-01-21 01:11:11 PM
cppbuilder50
Hello!
I would like to now how i can use wsprintfW
I get this error when i try to use it [C++ Error] Unit2.cpp(179): E2451
Undefined symbol 'wsprintf_instead_use_StringCbPrintf_or_StringCchPrintf'
my code:
WCHAR wsz[256];
wsprintf(wsz, L"FilterGraph %08x pid %08x", (DWORD_PTR)pUnkGraph,
GetCurrentProcessId());
//Tobias
 
 

Re:wsprintfW error

"Tobias" < XXXX@XXXXX.COM >wrote in message
Quote
I get this error when i try to use it [C++ Error] Unit2.cpp(179):
E2451
Undefined symbol
'wsprintf_instead_use_StringCbPrintf_or_StringCchPrintf'
The error is intentional. Like the message says, wsprintf() has been
replaced with StringCbPrintf() and StringCchPrintf(). wsprintf() is
deprecated and is considered unsafe. So are similar functions, such
as lstrcpy(). Microsoft designed its newer Win32 SDK headers to
intentionally fail with linker errors on such functions. In order to
see that message in the first place, you obviously have the newer
headers installed. So you should do what the message says and use
StringCbPrintf() or StringCchPrintf() instead of wsprintf() from now
on.
Gambit
 

Re:wsprintfW error

"Tobias" < XXXX@XXXXX.COM >wrote in message
Quote
I would like to now how i can use wsprintfW
If you really want to call wsprintfW(), then you have to call it
explicitally rather than through the macro that you are currently
using, ie:
WCHAR wsz[256];
wsprintfW(wsz, L"FilterGraph %08x pid %08x", pUnkGraph,
GetCurrentProcessId());
Gambit
 

{smallsort}