拷贝文件以后的奇怪现象
在一个系统里面设置了文件拷贝的操作。代码如下:
CFileDialog *file = new CFileDialog (TRUE) ;
TCHAR *path = new TCHAR[1000] ;
CString str ;
::ZeroMemory (path, 1000) ;
GetModuleFileName (NULL, path, 1000) ;
//GetCurrentDirectory (1000, path) ;
file->DoModal () ;
str = file->GetPathName() ; //获取文件的绝对路径
TCHAR FilePath[256] = {0};
TCHAR Drive[4], Dir[128], FileName[132], Ext[20];
GetModuleFileName(NULL, FilePath, _countof(FilePath));
CString str1(FilePath) ;
int n = str1.ReverseFind (TEXT('\\')) ;
CString str2 = str1.Left (n+1) ;
int m = str.ReverseFind (TEXT('\\')) ;
int j = str.GetLength () - m ;
CString str3 = str.Right (j-1) ;
str2 = str2 + TEXT("墙纸成品\\") + str3 ;
BOOL bl = CopyFile (str, str2, FALSE ) ;
if(bl)
{
::MessageBox (this->m_hWnd, TEXT("成功copy"), NULL, 0) ;
}
else
{
::MessageBox (this->m_hWnd, TEXT("失败copy"), NULL, 0) ;
}
可是拷贝完文件以后,再打开数据库的时候,怎么会出现“ERROR 打开数据库异常 错误信息:未指定的信息 ” “打开数据库时异常 错误信息 unknow error 0x800A0E78”,难道是拷贝文件的操作使程序找不到access数据库文件?(注:若不使用程序拷贝 手动移动文件不会出错) 请问有什么好的解决方案 !谢谢。。