本文介绍了CComVariant :: Detach()失败的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
以下代码失败:
CString s;
dialogpointer-> GetWindowText(s);
CComVariant(s).Detach(NameVariantPointer);
但是以下方法可以正常工作:
CString s;
dialogpointer-> GetWindowText(s);
CComVariant var(s);
NameVariantPointer-> bstrVal = var.bstrVal;
the following code fails:
CString s;
dialogpointer->GetWindowText(s);
CComVariant(s).Detach(NameVariantPointer);
But the following works fine:
CString s;
dialogpointer->GetWindowText(s);
CComVariant var(s);
NameVariantPointer->bstrVal = var.bstrVal;
推荐答案
{
VARIANT vTest = {0};
CComVariant(_T("test")).Detach(&vTest);
...
}
这篇关于CComVariant :: Detach()失败的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!