FileOperation函数在全路径下野无法删除文件,该如何处理

FileOperation函数在全路径下野无法删除文件
源代码如下:
CString str;
str=CCablesModelDlg::GetCurrentDirectory();
CString strpath3=str+"\\defultcables.gbl";
SHFILEOPSTRUCT FileDelete3;
FileDelete3.hwnd=this->m_hWnd;
FileDelete3.wFunc=FO_DELETE;
FileDelete3.pFrom=strpath3;
FileDelete3.pTo="";
FileDelete3.fAnyOperationsAborted=TRUE;
FileDelete3.fFlags=FOF_NOCONFIRMATION | FOF_NOERRORUI | FOF_SILENT;
FileDelete3.lpszProgressTitle="";
int c=SHFileOperation(&FileDelete3);
如上代码,defultcables.cbl就在*.exe的目录下,可是还是无法删除。

GetCurrentDirectory()函数是用来获得当前运行的.exe的路径,具体实现如下:
CString CCablesModelDlg::GetCurrentDirectory()//获得当前运行的.exe的路径
{
char path[MAX_PATH];
GetModuleFileName(NULL,path,MAX_PATH);
CString str=(CString)path;
int nPos=str.ReverseFind('\\');
if (nPos==-1)
{
return "";
}
else
{
if(str.Right(1)=="\\")
str=str.Left(nPos-1);
else
str=str.Left(nPos);
}
return str;
}

------解决方案--------------------
我们说要用全路径绝大多数情况是避免使用“当前路径计算全路径”,而你这里恰恰是用GetCurrentDirectory先得到一个路径,再计算全路径,这和使用相对路径没有任何区别。

要记住:当前路径是随时可以变掉的路径,你用不同方法两次运行同一个程序,当前路径都可以不同,所以依赖GetCurrentDirectory得到路径的方法肯定是不行的