Click here to Skip to main content
15,897,273 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
I am getting
<br />
error C2664: 'midiInGetErrorTextW' : cannot convert parameter 2 from 'char [128]' to 'LPWSTR'
How to solve this error?
Posted

I had similar error message when using GDI+ in a non-unicode app. My filenames were simple char*, yet the load function needed WCHAR*

You just need to use MultiByteToWideChar.

C++
WCHAR wFilename[MAX_PATH];
string fileName;
char *filename;

filename = (char*)fileName.c_str();
MultiByteToWideChar(CP_ACP,MB_PRECOMPOSED,filename,-1,wFilename,MAX_PATH);



afterwards, wFilename is able to be passed to something wanting a LPWSTR.
 
Share this answer
 
Change the Project properties in character set to Use Multi-Byte Character Set

solved my problem
 
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