HRESULT hr;
IDispatch *pDisp;
pDisp = m_Web.get_Document();  // 获取WebBrowser控件文档接口
IHTMLDocument2 *pDoc;
hr = pDisp->QueryInterface(IID_IHTMLDocument2,(void**)&pDoc); // 获取登陆界面文档接口
IHTMLElementCollection * pColl = NULL;
hr = pDoc->get_all(&pColl);  // 获取网页元素集合 IDispatch *pDisp2 = NULL;
VARIANT index;
VARIANT varID;
V_VT(&index) = VT_I4;
V_I4(&index) = 0;
varID = StringToVariant(strID);  // 按钮ID字符串格式转换 hr = pColl->item(varID,index,&pDisp2);  // 获得按钮位置
if (hr == S_OK && pDisp2 != NULL)
{
IHTMLSelectElement *pSelect = NULL;  // 获得选择框元素接口
hr = pDisp2->QueryInterface(IID_IHTMLElement,(void**)&pSelect); // 查询接口 if (hr == S_OK && pSelect != NULL)
{
pSelect->put_selectedIndex(numIndex);    // 选择索引为index的item
pSelect->Release(); 
}
pDisp2->Release();
pDisp->Release();
}
pSelect->put_selectedIndex(numIndex); 执行到这句,提示这样的错误
中的 0x3db072f3 处有未经处理的异常: 0xC0000005: 写入位置 0x00000002 时发生访问冲突