BOOL CopyFile(
LPCTSTR lpExistingFileName, // pointer to name of an existing fileLPCTSTR lpNewFileName, // pointer to filename to copy to
BOOL bFailIfExists // flag for operation if file exists
);
其中各参数的意义:
LPCTSTR lpExistingFileName, // 你要拷贝的源文件名
LPCTSTR lpNewFileName, // 你要拷贝的目标文件名
BOOL bFailIfExists // 如果目标已经存在,不拷贝(True)并返回False;覆盖目标(false)
如:
//拷贝文件c:\log.txt到d:\log.txt,如果D:\log.txt已经存在,就覆盖
CopyFile("c:\\log.txt","d:\\log.txt",false);
void CContra::OnDblclkList1(NMHDR* pNMHDR, LRESULT* pResult)
{//双击列表视图
NM_LISTVIEW *pNMListView=(NM_LISTVIEW *)pNMHDR;
int nItem=pNMListView->iItem;
CString smark;
if(nItem>=0 && nItem<m_Tgrid.GetItemCount())//判断双击位置是否在有数据的列表项上面
{
m_pos=m_Tgrid.GetSelectionMark();//获取要查看的记录
smark = m_Tgrid.GetItemText(m_pos,1);
CContraDetail dlg;
dlg.DeID=smark;
dlg.DoModal();
}
*pResult = 0;
}