wsprintf in 32 and 64 bit windows.
-
CFileVersionInfo fvi;
char szVer[ 512 ] = { 0 };
if( fvi.Open( _T( "Econovent.dll" )))
{
::wsprintf( szVer,
_T( "%d.%d.%d.%d" ),
fvi.GetFileVersionMajor(), // Major version
fvi.GetFileVersionMinor(), // Minor version
fvi.GetFileVersionBuild(), // Build number
fvi.GetFileVersionQFE() // QFE
);
fvi.Close();}It works perfect in win32, But when complied in x64 the "wsprintf", stops working. Are the a better solution that works in x64 and win32 at the same time. I understand that i have change. I have tried but then its not working in win32 mode. The code need to be old C-style version. I'm not native C/C++ i'm just trying to fixa a "bug".
-
CFileVersionInfo fvi;
char szVer[ 512 ] = { 0 };
if( fvi.Open( _T( "Econovent.dll" )))
{
::wsprintf( szVer,
_T( "%d.%d.%d.%d" ),
fvi.GetFileVersionMajor(), // Major version
fvi.GetFileVersionMinor(), // Minor version
fvi.GetFileVersionBuild(), // Build number
fvi.GetFileVersionQFE() // QFE
);
fvi.Close();}It works perfect in win32, But when complied in x64 the "wsprintf", stops working. Are the a better solution that works in x64 and win32 at the same time. I understand that i have change. I have tried but then its not working in win32 mode. The code need to be old C-style version. I'm not native C/C++ i'm just trying to fixa a "bug".
jn4u@msn.com wrote:
the "wsprintf", stops working.
You need to provide some more information, as this does not give any clues as to what may be happening. Try using your debugger to step through your code and see exactly what values are being returned from the function calls.
Binding 100,000 items to a list box can be just silly regardless of what pattern you are following. Jeremy Likness
-
CFileVersionInfo fvi;
char szVer[ 512 ] = { 0 };
if( fvi.Open( _T( "Econovent.dll" )))
{
::wsprintf( szVer,
_T( "%d.%d.%d.%d" ),
fvi.GetFileVersionMajor(), // Major version
fvi.GetFileVersionMinor(), // Minor version
fvi.GetFileVersionBuild(), // Build number
fvi.GetFileVersionQFE() // QFE
);
fvi.Close();}It works perfect in win32, But when complied in x64 the "wsprintf", stops working. Are the a better solution that works in x64 and win32 at the same time. I understand that i have change. I have tried but then its not working in win32 mode. The code need to be old C-style version. I'm not native C/C++ i'm just trying to fixa a "bug".
Use
GetLastError()
method after you called wsprintf and provide the error code
-
CFileVersionInfo fvi;
char szVer[ 512 ] = { 0 };
if( fvi.Open( _T( "Econovent.dll" )))
{
::wsprintf( szVer,
_T( "%d.%d.%d.%d" ),
fvi.GetFileVersionMajor(), // Major version
fvi.GetFileVersionMinor(), // Minor version
fvi.GetFileVersionBuild(), // Build number
fvi.GetFileVersionQFE() // QFE
);
fvi.Close();}It works perfect in win32, But when complied in x64 the "wsprintf", stops working. Are the a better solution that works in x64 and win32 at the same time. I understand that i have change. I have tried but then its not working in win32 mode. The code need to be old C-style version. I'm not native C/C++ i'm just trying to fixa a "bug".
When compling in platform win32 works. Whan compile in x64. cannot convert parameter 1 from 'char [512]' to 'LPWSTR' in the wsprintf call first parameter szVer. Understand that de definition "change" för char in the call or I have tride windhows.h and TCHAR.
-
CFileVersionInfo fvi;
char szVer[ 512 ] = { 0 };
if( fvi.Open( _T( "Econovent.dll" )))
{
::wsprintf( szVer,
_T( "%d.%d.%d.%d" ),
fvi.GetFileVersionMajor(), // Major version
fvi.GetFileVersionMinor(), // Minor version
fvi.GetFileVersionBuild(), // Build number
fvi.GetFileVersionQFE() // QFE
);
fvi.Close();}It works perfect in win32, But when complied in x64 the "wsprintf", stops working. Are the a better solution that works in x64 and win32 at the same time. I understand that i have change. I have tried but then its not working in win32 mode. The code need to be old C-style version. I'm not native C/C++ i'm just trying to fixa a "bug".
check your build settings. you probably have "Multi-byte" or "Unicode" set for "Character set" on the x64 build, but "not set" on the x86 build.
-
CFileVersionInfo fvi;
char szVer[ 512 ] = { 0 };
if( fvi.Open( _T( "Econovent.dll" )))
{
::wsprintf( szVer,
_T( "%d.%d.%d.%d" ),
fvi.GetFileVersionMajor(), // Major version
fvi.GetFileVersionMinor(), // Minor version
fvi.GetFileVersionBuild(), // Build number
fvi.GetFileVersionQFE() // QFE
);
fvi.Close();}It works perfect in win32, But when complied in x64 the "wsprintf", stops working. Are the a better solution that works in x64 and win32 at the same time. I understand that i have change. I have tried but then its not working in win32 mode. The code need to be old C-style version. I'm not native C/C++ i'm just trying to fixa a "bug".
Can i change the code copy to the szVer in a better way that does not use wsprint. Just want the format. xx.xx.xx.xx
-
check your build settings. you probably have "Multi-byte" or "Unicode" set for "Character set" on the x64 build, but "not set" on the x86 build.
Thank you. I missed that on my project. It’s work perfect. Some of my collage at work pointed out that change to “std::string” in the project. But still the interface to dll need to be native C with c-style string. Is std::string more neutral to the character set? Comming from Delphi to C# world then C/C++ for this project lot of reading "new" things. My old Charles Petzold book is back on the self again. ;D
-
Can i change the code copy to the szVer in a better way that does not use wsprint. Just want the format. xx.xx.xx.xx
You should use
TCHAR
for your array and_stprintf()
to fill it. In that way you can compile for ANSI or Unicode without the need to change your source.Binding 100,000 items to a list box can be just silly regardless of what pattern you are following. Jeremy Likness
-
Thank you. I missed that on my project. It’s work perfect. Some of my collage at work pointed out that change to “std::string” in the project. But still the interface to dll need to be native C with c-style string. Is std::string more neutral to the character set? Comming from Delphi to C# world then C/C++ for this project lot of reading "new" things. My old Charles Petzold book is back on the self again. ;D
jn4u wrote:
Is std::string more neutral to the character set?
sadly, no. there is a std::wstring variation to handle wide char strings.