Porting up to VC++ 2005



Hi,
Thanks to everyone for you past help with VC++6

I have been using the code below with VC++6 with no errors and seems to work
fine.
When I try to do the same in VC++ 2005 I get errors:

Line: nSelect=SendDlgItemMessage(IDC_LIST1, LB_GETCURSEL, 0, 0L);
warning C4244: '=' : conversion from 'LRESULT' to 'int', possible loss of
data

Line: DlgDirSelect((LPSTR) cSelect, IDC_LIST1);
error C2664: 'BOOL CWnd::DlgDirSelect(LPTSTR,int)' : cannot convert
parameter 1 from 'LPSTR' to 'LPTSTR'

What do I need to chane for it to work under VC++ 2005 ?
Or, how do I code this properly?

void CMyDlg::OnLbnSelchangeList1()
{
CString JobFile;
TCHAR cSelect[50];
int Length;
int nSelect;

nSelect=SendDlgItemMessage(IDC_LIST1, LB_GETCURSEL, 0, 0L);
DlgDirSelect((LPSTR) cSelect, IDC_LIST1);
Length=strlen(cSelect); //get length of filename
string
if (cSelect[Length-1]==0x2e) //if last char is "."
remove it
cSelect[Length-1]=0;
JobFile = _T("C:\\Temp\\"); //re-apply main part of
path to files
JobFile += _T(cSelect); //add filename selected
JobFile += _T(".dat"); //re-apply file extension

CString mess;
mess.Format(_T("Would you like to load \"%s\" as top ?"), cSelect);
int a = AfxMessageBox(mess, MB_ICONQUESTION | MB_YESNO);
if(a != IDYES)
return;

AfxMessageBox(cSelect); //display selected filename
as test
}


.


Loading