代码里关于多页TIF文件合并和分解的下面有段代码有个疑问:
Image imgTif(L"G:\\GDItif\\Debug\\tif\\mutitif.tif"); //字符串前的“L”是什么意思?
CString tifPath = GetAppPath(),tifName;
tifPath = tifPath+"\\tif\\mutitif.tif"; 
Image imgTif(tifPath); 
//这里编译就会报:error C2664: '__thiscall Gdiplus::Image::Gdiplus::Image(const unsigned short *,int)' : cannot convert parameter 1 from 'class CString' to 'const unsigned short *'
        No user-defined-conversion operator available that can perform this conversion, or the operator cannot be called 我想问的是怎样在变量前加上那个“L”啊,
Image imgTif(L(tifPath));  //这样加的话就会报:error C2065: 'L' : undeclared identifier
L为声明的错,我真不知道该怎么解决,就请教大家了……
在线等啊!

解决方案 »

  1.   


    CString tifPath = GetAppPath(),tifName;
    tifPath = tifPath+"\\tif\\mutitif.tif"; WCHAR wTifName[260] = {0};
    MultiByteToWideChar(CP_ACP, 0, tifPath, -1, wTifName, 260);Image imgTif(wTifName);
      

  2.   

    Image执行后有会修改Status,你可以查一下开发文档,具体忘了
      

  3.   


      int num;
      WCHAR *wTifName;
      num = MultiByteToWideChar(CP_ACP, 0,  (LPCTSTR)imagePath, -1, NULL, 0); 
      wTifName = new WCHAR[num];
    MultiByteToWideChar(CP_ACP, 0,  (LPCTSTR)imagePath, -1, wTifName, num);
    // Image imgTif(L"E:\\GDItif\\Debug\\tif\\mutitif.tif"); Image imgTif(imagePath);
    GUID guidtif;
    UINT iFrameDimensionsCount = imgTif.GetFrameDimensionsCount();
    imgTif.GetFrameDimensionsList(&guidtif,iFrameDimensionsCount);
    int totalPage = imgTif.GetFrameCount(&guidtif); //这里的GetFrameCount老是返回0,
    不知道为什么,调试也看不出问题,我直接赋上常量就能正常执行,效果也有,我上面转换应该枚问题吧!