CString tempDir = VideoPath; if(tempDir.Right(1) != "\\")
{
tempDir.Insert(tempDir.GetLength() - 1, "\\");
//tempDir += "\\";
} tempDir += "*.*";
其中VideoPath是CString的全局变量,为什么执行完后,tempDir保持VideoPath原来的值,没有改变,不论执不执行if里面的都一样。
{
tempDir.Insert(tempDir.GetLength() - 1, "\\");
//tempDir += "\\";
} tempDir += "*.*";
其中VideoPath是CString的全局变量,为什么执行完后,tempDir保持VideoPath原来的值,没有改变,不论执不执行if里面的都一样。
if(tempDir.Right(1) != "\\")
{
tempDir.Insert(tempDir.GetLength(), "\\");
//tempDir += "\\";
}
这个不应该用Insert吧。应该用tempDir += "\\";
[email protected]
{
char *lpStr1 = (LPSTR)(LPCTSTR)VideoPath;
BOOL te = PathFileExists(lpStr1);
if (!te)
{
char* msg = "指定文件夹不存在.";
char* title = "错误";
MessageBox(msg, title, MB_OK | MB_ICONERROR);
return;
} CFileFind ff;
int Dindex = 0;
CString tempDir = VideoPath; if(tempDir.Right(1) != "\\")
{
tempDir.Insert(tempDir.GetLength() - 1, "\\");
//tempDir += "\\";
} tempDir += "*.*"; BOOL res = ff.FindFile(tempDir);
m_COBDevice.Clear();
while(res)
{
res = ff.FindNextFile(); Dindex ++; if(ff.IsDirectory() && !ff.IsDots())
{
CString strTitle = ff.GetFileTitle();
m_COBDevice.InsertString(Dindex, strTitle);
}
}
}
这是整个函数
引用的这个
extern CString VideoPath;
关注中。
期待解答。
顶。
{
tempDir += "\\";
//tempDir.Insert(tempDir.GetLength() - 1, "\\");
//tempDir += "\\";
} 这样可以,VC6 SP5 测试通过。
难道VideoPath有什么问题嘛
tempDir += "\\";是应该没有问题的,你设置断点,再试试。
郁闷中。
能不能 VideoPath先加\\*.*,然后再让tempdir等于它呢??
这段代码没有问题的。关键是你那个VideoPath;的值对不对??
加一句判断
看路径对不对???
前面
#include "io.h"
if(access(VideoPath,0))
{
AfxMessageBox("他奶奶的。这个路径不存在了,去哪儿了?????");
}
向三哥请教一下就行了
以后我都跟小三混了
-------------------
我也是小弟啊。我也想找老大。。呵呵。。^_^。