编译时出现提示:Undefined symbol '_variant_t',为何?
时间:2011-12-11
来源:互联网
用到如下代码,编译时出现提示:Undefined symbol '_variant_t',为何?加入头文件COMUTIL.H,链接时又出现问题
HRESULT GetOptions(IHTMLSelectElement *ppvSelect, BSTR *pszOptText, long *plItems)
{
IDispatch *ppvdispOption;
IHTMLOptionElement *ppvOption;
HRESULT hResult;
// Obtain the number of option objects in the select object.
ppvSelect->get_length(plItems);
for (long i=0;i<*plItems;i++){
// Get an IDispatch interface for the next option.
_variant_t index = i;
hResult = ppvSelect->item( index, index, &ppvdispOption );
if FAILED(hResult) return(hResult);
// Query for the IHTMLOptionElement interface.
hResult = ppvdispOption->QueryInterface( IID_IHTMLOptionElement,
(void **) &ppvOption);
ppvdispOption->Release();
if FAILED(hResult) return(hResult);
// Add the option text to a list box.
hResult = ppvOption->get_text(&(pszOptText[i]));
ppvOption->Release();
if FAILED(hResult) return(hResult);
}
return S_OK;
}
HRESULT GetOptions(IHTMLSelectElement *ppvSelect, BSTR *pszOptText, long *plItems)
{
IDispatch *ppvdispOption;
IHTMLOptionElement *ppvOption;
HRESULT hResult;
// Obtain the number of option objects in the select object.
ppvSelect->get_length(plItems);
for (long i=0;i<*plItems;i++){
// Get an IDispatch interface for the next option.
_variant_t index = i;
hResult = ppvSelect->item( index, index, &ppvdispOption );
if FAILED(hResult) return(hResult);
// Query for the IHTMLOptionElement interface.
hResult = ppvdispOption->QueryInterface( IID_IHTMLOptionElement,
(void **) &ppvOption);
ppvdispOption->Release();
if FAILED(hResult) return(hResult);
// Add the option text to a list box.
hResult = ppvOption->get_text(&(pszOptText[i]));
ppvOption->Release();
if FAILED(hResult) return(hResult);
}
return S_OK;
}
作者: xdxwb001 发布时间: 2011-12-11
将_variant_t换成VARIANT就行了。
作者: ccrun 发布时间: 2011-12-11
相关阅读 更多
热门阅读
-
office 2019专业增强版最新2021版激活秘钥/序列号/激活码推荐 附激活工具
阅读:74
-
如何安装mysql8.0
阅读:31
-
Word快速设置标题样式步骤详解
阅读:28
-
20+道必知必会的Vue面试题(附答案解析)
阅读:37
-
HTML如何制作表单
阅读:22
-
百词斩可以改天数吗?当然可以,4个步骤轻松修改天数!
阅读:31
-
ET文件格式和XLS格式文件之间如何转化?
阅读:24
-
react和vue的区别及优缺点是什么
阅读:121
-
支付宝人脸识别如何关闭?
阅读:21
-
腾讯微云怎么修改照片或视频备份路径?
阅读:28