关于vc下路径设置的问题,各位大侠,帮我看看这段代码,很急
bool CCwDlg::FindFile(bool copyUDisk)
{
bool GetDrive;
char S[2];
char f[]="D:\\myfile\\my\\";
char volname[255],filename[100];
DWORD sno,maxl,fileflag;
CString UDisk;
GetDrive=false;
if (GetVolumeInformation(f,volname,255,&sno,&maxl,&fileflag,filename,100))
{
GetDrive=true;
AfxMessageBox(S,MB_OK);
if (copyUDisk)
{
CreateDirectory("E:\\UDISK",NULL);
MyCopyFile(S,"E:\\UDISK");
}
}
if (GetDrive)
{
nid.hIcon=AfxGetApp()->LoadIcon(IDI_ICONgreen);
Shell_NotifyIcon(NIM_MODIFY, &nid);
}
else
{
nid.hIcon=AfxGetApp()->LoadIcon(IDI_ICONyellow);
Shell_NotifyIcon(NIM_MODIFY, &nid);
}
return GetDrive;
}
我这段代码是要实现查找到指定路径的文件再添用我自定义的成员函数MyCopyFile复制到目标文件里
在指定路径的时候若选用D:\则GetVolumeInformation(S,volname,255,&sno,&maxl,&fileflag,filename,100))返回非零,可以实现(其中S表示D:\)。但是若选择D:\mygile\my\根目录则GetVolumeInformation(f,volname,255,&sno,&maxl,&fileflag,filename,100)返回0(其中f表示D:\mygile\my\)请问这是怎么回事?是不是路径设置有问题,那又该怎样设呢?