CString a;
BSTR b;
a="a";
b=(BSTR)"a";
if (a.AllocSysString()==b)
printf("ok");
else
printf("bad");//为什么程序运行后总出现bad,如何比较a和b呢?
//也就是如何输出ok呢?
BSTR b;
a="a";
b=(BSTR)"a";
if (a.AllocSysString()==b)
printf("ok");
else
printf("bad");//为什么程序运行后总出现bad,如何比较a和b呢?
//也就是如何输出ok呢?
BSTR b;
a="a";
b=(BSTR)"a";
CString st=a.AllocSysString();
if (st==b)
MessageBox("ok");
else
MessageBox("bad");
如果是的话,程序可以改为:
CString a;
BSTR b;
a="a";
b=(BSTR)"a";
if (*a.AllocSysString()==*b)
printf("ok");
else
printf("bad");这样就可以输出ok了。我的问题是:为什么BSTR是指针类型呢?怎么看出来呢?
typedef WCHAR OLECHAR;
#else
typedef char OLECHAR;
#endiftypedef OLECHAR* BSTR;------------------from afxwin.h