문제

I got an error:

error C2664: 'CFileDialog::CFileDialog(BOOL,LPCTSTR,LPCTSTR,DWORD,LPCTSTR,CWnd *,DWORD,BOOL)' : cannot convert parameter 5 from 'const char [52]' to 'LPCTSTR'

in the following code:

CFileDialog dlgFile(TRUE, NULL, NULL, OFN_HIDEREADONLY | OFN_OVERWRITEPROMPT, "Movie Files (*.avi;*.mpg;*.mp4)|*.avi;*.mpg;*.mp4||", this);

Please help me. this code worked fine in one project, but when I copy it to other project, it shows the error above.

도움이 되었습니까?

해결책

I expect one project is built as UNICODE and the other is ANSI or MBCS.

Try using the _TEXT() macro, like this:

CFileDialog dlgFile(TRUE, NULL, NULL, OFN_HIDEREADONLY | OFN_OVERWRITEPROMPT, 
    _T("Movie Files (*.avi;*.mpg;*.mp4)|*.avi;*.mpg;*.mp4||"), this);
라이센스 : CC-BY-SA ~와 함께 속성
제휴하지 않습니다 StackOverflow
scroll top