Click here to Skip to main content
15,886,724 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
See more:
hi

this code working fine on window XP but on window 8 not working and project setting character ==Use Multi-Byte Character Set other then UNICODE please suggest the solution its urgent

C++
Cstring FolerPath;
Bitmap bmp;

int nLen = FolerPath.GetLength() + 1;
WCHAR* pwsz = new WCHAR [nLen];   
mbstowcs (pwsz,FolerPath,nLen);
CLSID encoderClsid;
GetEncoderClsid(L"image/bmp",&encoderClsid);		
bmp.Save(pwsz,&encoderClsid,NULL);				
delete pwsz;	


error on saving bitmap =win32Error on window 8
Posted
Updated 7-Nov-13 0:47am
v4
Comments
Mohibur Rashid 25-Oct-13 2:21am    
permission error?
nv3 25-Oct-13 3:15am    
It is not clear from your question whether you compiled with "Multi-Byte Character Set" on both, Windows XP and Windows 8.

Then, if you are compiling with "Multi-Byte Character Set", why are you converting the file path to Unicode for the call of bmp.Save?

Your code snipped does not tell, what types FolderPath and bmp have.

Finally, which error do you get when you run it on Windows 8, i.e. what is the return code of GetLastError ()?
chaau 28-Oct-13 1:46am    
Have you also tried to ask on stackoverflow? Expert-Exchange has your question.
Richard MacCutchan 7-Nov-13 7:03am    
What is the error that you receive?

1 solution

It is not clear if FolderPath is compiled as CStingA (type char) or CStringW (type wchar_t). CSting is a macro which result in the types CStingA or CStringW. CStringW is used if _UNICODE and UNICODE is defined.
 
Share this answer
 

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900