谢谢!

解决方案 »

  1.   

    LPCOLESTR这个是什么类型来的?没见过……~不懂,帮你UP
      

  2.   

    在OnOpenDucument()中直接用这个参数LPCOLESTR就行了
      

  3.   

    其实
    #define LPCOLESTR       LPCSTR而 LPCSTR 在OLE.h 中是这样的#define LPCSTR      LPSTR
    又LPSTR   A 32-bit pointer to a character string.所以应该可以这样CString str("test");
    LPSTR lpsz = new char[str.GetLength() + 1];
    strcpy(lpsz,(LPCTSTR)str);
      

  4.   

    接上面  然后强制转换一下
    (LPCOLESTR)lpsz    
    ...记得释放内存
      

  5.   

    CString cStr = _T("Hello,world!");
    LPCOLESTR lpszBuf = cStr.GetBufferSetLength (cStr.GetLength());
    cStr.ReleaseBuffer();
      

  6.   

    #include "atlconv.h"
    T2OLE
    OLE2T
      

  7.   

    我也有遇到这个问题,使用的方法是:
    CString str;
    .....
    LPCOLESTR lpcolestr= (LPSTR)(LPCSTR)str;
    但是在我将这个lpcolestr 显示出来时,却出现了乱码,奇怪,不知道为什么,请指点。
      

  8.   

    LPOLESTR is a null-terminated UNICODE string 
    LPOLESTR is a LPWSTR which is a WCHAR * 
    BSTR and LPOLESTR are not identical
      

  9.   

    http://www.devguy.com/fp/Tips/COM/bstr.htm
      

  10.   


    ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
    我也有遇到这个问题,使用的方法是:
    CString str;
    .....
    LPCOLESTR lpcolestr= (LPSTR)(LPCSTR)str;
    但是在我将这个lpcolestr 显示出来时,却出现了乱码,奇怪,不知道为什么,请指点。~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
    问题解决,在前加 USES_CONVERSION即可。