CString init;  GetModuleFileName(NULL, (LPWSTR)(LPCTSTR)init, 512);  int ln = init.ReverseFind('\\');  int lb = init.GetLength();
ln返回正常但lb返回0,什么原因啊,如果把init换成char型当init转换成CString时只有char[0]的内容为什么啊用的是vs2010在vc6.0下什么问题也没有的

解决方案 »

  1.   

    不行给点意见,建议也行啊,现在没办法给了,自己给了个固定的路径
    而且发现Left,Right功能都失效了。
    求解啊
      

  2.   

    原因不清楚,把init定为TCHAR型, TCHAR init[512],
    获取文件的长度可以直接获取,不用getlength
    int  len=GetModuleFileName(NULL, init, 512); 
    要使用Left和Right就 CString mm=init, 就可以了
      

  3.   

    改改 
    (LPWSTR)(LPCTSTR)init
      

  4.   

    CString strModulePath,strPath;
    ::GetModuleFileName(NULL, strModulePath.GetBuffer(MAX_PATH), MAX_PATH);
    strModulePath.ReleaseBuffer();
    int nL = strModulePath.ReverseFind(_T('\\'));
    strModulePath = strModulePath.Left(nL+1); 
    strPath = strModulePath + _T("cursor\\");我也是在vs2010.