调试跟踪看看,在哪里出错 

解决方案 »

  1.   

    CString是个字符串数组,你SetAt的时候数组越界了。
    当你第一次初始化m_ImageFold的时候,长度就固定了,你不能用超过字符串长度的索引来SetAt参考msdn:
    You can think of a CString object as an array of characters. The SetAt member function overwrites a single character specified by an index number.SetAt will not enlarge the string if the index exceeds the bounds of the existing string.取目录可以这样
    CString ImageFileName = dlg.GetFileName();
    CString ImagePathName = dlg.GetPathName();
    CString ImageFolder = ImagePathName.Left(ImagePathName.Length() - ImageFileName.Length());网上抄的...那边百度回答你MSDN说明的也是我....咋地能有一个得分吧..哈哈
      

  2.   

    单步调试一下, 估计是索引等越界了