Click here to Skip to main content
15,921,989 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
See more:
Hi all,
I want to use CFileDialog class to open an xml file. For that I've used the following codes.

static char BASED_CODE szFilter[] = "Scan Report(*.xml)|*.xml||";

CFileDialog dlg(1,"xml","Scan Report",OFN_OVERWRITEPROMPT|OFN_PATHMUSTEXIST|OFN_HIDEREADONLY,szFilter);


But I am receiving the following error..

E:\Jijesh\ReportEx\ReportExDlg.cpp(229) : error C2664: 'CFileDialog::CFileDialog' : cannot convert parameter 3 from 'char [12]' to 'const unsigned short *'


Please help me.
Posted
v3

I think you have to enclose your strings in _T(""),like "string" to _T("string").
 
Share this answer
 
You are probably getting a similar error for parameter 2, try:
C++
TCHAR szFilter[] = _T("Scan Report(*.xml)|*.xml||");
CFileDialog dlg(1,_T("xml"),_T("Scan Report"),OFN_OVERWRITEPROMPT|OFN_PATHMUSTEXIST|OFN_HIDEREADONLY,szFilter);
 
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