IHTMLDocument
HRESULT CMyWebBrowserDlg::OnButtonCancel(IHTMLElement* pElement) { //Navigate(_T("http://www.baidu.com")); CString url; GetCurrentUrl(url); CComPtr<IHTMLInputElement> BtnOK; GetElementInterface(_T("TestButton"), IID_IHTMLInputElement, reinterpret_cast<void**>(&BtnOK)); if (BtnOK) { IHTMLElement* pControl = NULL; BtnOK->QueryInterface(IID_IHTMLElement, (void**)&pControl); pControl->click(); pControl->Release(); IHTMLControlElement* pControl2 = NULL; BtnOK->QueryInterface(IID_IHTMLControlElement, (void**)&pControl2); pControl2->focus(); pControl2->Release(); //CComBSTR value; //BtnOK->get_value(&value); //if (value == L"确定") // BtnOK->put_value(L"取消"); //else // BtnOK->put_value(L"确定"); } //OnCancel(); return S_OK; }