Prev: LNK2001
Next: URLDownloadToFile
From: David F on 16 Jun 2005 10:38 Thanks to all responders. I forgot to mention that I took code that worked with VC++ Studio 2003 as is. That added to my surprise. Thanks again, David "David Carlsson" <dacaatREMOVE(a)homeTHIS.se> wrote in message news:OuDS3QlcFHA.1448(a)TK2MSFTNGP14.phx.gbl... > Does your project use Unicode. > This is a snippet from winuser.h where wsprintf is defined > > WINUSERAPI > int > WINAPIV > wsprintfA( > OUT LPSTR, > IN LPCSTR, > ...); > WINUSERAPI > int > WINAPIV > wsprintfW( > OUT LPWSTR, > IN LPCWSTR, > ...); > #ifdef UNICODE > #define wsprintf wsprintfW > #else > #define wsprintf wsprintfA > #endif // !UNICODE > > As you can see wsprintf is defined as a macro for wsprintfW och wsprintfA depending on UNICODE or not. > > /David > > > David F wrote: > > I am getting the following 2 error messages from the compiler: > > > > f:\development\projects 2005\fc\fc.cpp(296) : error C2664: 'wsprintfW' : > > cannot convert parameter 1 from 'LPSTR' to 'LPWSTR' > > > > Types pointed to are unrelated; conversion requires > > reinterpret_cast, C-style cast or function-style cast > > > > > > > > f:\development\projects 2005\fc\fc.cpp(373) : error C2664: 'FindFirstFileW' > > : cannot convert parameter 1 from 'const char *' to 'LPCWSTR' > > > > Types pointed to are unrelated; conversion requires > > reinterpret_cast, C-style cast or function-style cast > > > > > > My code does not have "wsprintfW" & "FindFirstFileW" ! > > What I do have is "wsprintf" & "FindFirstFile". > > > > Anybody heard about such behavior of the C++ compiler? > > > > Thanks, > > David > > > >
From: Arnie on 16 Jun 2005 14:13 "David F" <David-White(a)earthlink.net> wrote in message news:uRns%23ElcFHA.2696(a)TK2MSFTNGP09.phx.gbl... >I am getting the following 2 error messages from the compiler: > > f:\development\projects 2005\fc\fc.cpp(296) : error C2664: > 'wsprintfW' : > cannot convert parameter 1 from 'LPSTR' to 'LPWSTR' > > Types pointed to are unrelated; conversion requires > reinterpret_cast, C-style cast or function-style cast > > > > f:\development\projects 2005\fc\fc.cpp(373) : error C2664: > 'FindFirstFileW' > : cannot convert parameter 1 from 'const char *' to 'LPCWSTR' > > Types pointed to are unrelated; conversion requires > reinterpret_cast, C-style cast or function-style cast > > > My code does not have "wsprintfW" & "FindFirstFileW" ! > What I do have is "wsprintf" & "FindFirstFile". > > Anybody heard about such behavior of the C++ compiler? > > Thanks, > David > I had the same problem. I just put a #undef UNICODE in stdafx.h before any of the includes were pulled in.
From: Jochen Kalmbach [MVP] on 16 Jun 2005 14:26
Hi Arnie! > I had the same problem. I just put a #undef UNICODE in stdafx.h > before any of the includes were pulled in. You shouldnýt do this! Please change the "character set" in your project settings (General) from Unicode to "Not set" or "Multibyte". -- Greetings Jochen My blog about Win32 and .NET http://blog.kalmbachnet.de/ |