0

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.

Tung Pham
  • 579
  • 4
  • 11
  • 29

1 Answers1

3

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);
Roger Rowland
  • 25,885
  • 11
  • 72
  • 113