Porting up to VC++ 2005
- From: "Kahlua" <kahlua@xxxxxxxxxx>
- Date: Sun, 27 Apr 2008 13:13:11 GMT
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
}
.
- Follow-Ups:
- Re: Porting up to VC++ 2005
- From: Scott McPhillips [MVP]
- Re: Porting up to VC++ 2005
- From: Joseph M . Newcomer
- Re: Porting up to VC++ 2005
- Prev by Date: Re: MultibyteToWideChar not working properly?
- Next by Date: Re: Porting up to VC++ 2005
- Previous by thread: Programming Discussion Forum
- Next by thread: Re: Porting up to VC++ 2005
- Index(es):
Loading