BSTR str;
char* str1;
str=SysAllocString(OLESTR("This is a Test!"));USES_CONVERSION;  //include "atlconv.h"
str1=OLE2T(str);
AfxMessageBox(OLE2T(str));
AfxMessageBox(str1);

解决方案 »

  1.   

    to yhp:
      我用OLE2T编译不通过阿——
    Compiling...
    RoomSet.cpp
    F:\COM\Applier\RoomSet.cpp(11) : error C2065: '_lpw' : undeclared identifier
    F:\COM\Applier\RoomSet.cpp(11) : error C2440: '=' : cannot convert from 'unsigned short *' to 'int'
            This conversion requires a reinterpret_cast, a C-style cast or function-style cast
    F:\COM\Applier\RoomSet.cpp(11) : error C2065: '_convert' : undeclared identifier
    Error executing cl.exe.
      

  2.   

    to yhp:
    我给了呀,20分,难道系统没有给你加上么,我的可用分已经减少20了。
    怎么给分?我是点“管理”连接到一个页面,里面每篇回复都对应一个编辑框,给你填了20,按确定,这样不行么?不过有个奇怪的问题是确定后返回页面显示的提示信息是乱字符,我也不知道成功了没有,后来看见自己的可用分变少了就默认为给你分了。