Ejemplo n.º 1
0
void CTryData4Dlg::DisableConfigDefault()
{
	char i;
	IHTMLElement *newElement;
	for(i='1';i<='9';i++)
	{
		VARIANT varEnable;
		varEnable.vt = VT_BOOL;
		varEnable.boolVal = (m_sConfSel.Compare(DEFAULT_NAME) == 0);;

		if(S_OK == this->GetElement(CString("alphalt")+i,&newElement))
			newElement->setAttribute(L"disabled",varEnable);
		if(S_OK == this->GetElement(CString("betalt")+i,&newElement))
			newElement->setAttribute(L"disabled",varEnable);
		if(S_OK == this->GetElement(CString("rstdlt")+i,&newElement))
			newElement->setAttribute(L"disabled",varEnable);

	}
}
Ejemplo n.º 2
0
void SetControlBoolAttribute(IHTMLDocument2 *pDoc, CString szId, CString szAttributeName, BOOL bValue)
{
    HRESULT hr = S_OK;
    IHTMLElement* pElem = NULL;
    hr = GetElementById(pDoc, szId, &pElem);
    if (hr == S_OK && pElem)
    {
        BSTR bstrAttributeName = szAttributeName.AllocSysString();
        VARIANT varAttr;
        varAttr.vt = VT_BOOL;
        varAttr.boolVal = bValue;
        pElem->setAttribute(bstrAttributeName, varAttr);
        ::SysFreeString(bstrAttributeName);
    }
}
Ejemplo n.º 3
0
void ExplorerElement::setAttribute(const char *attribute, const char*value)
{
	if (strcmp (attribute,"style") == 0)
		setStyleAttribute (m_pElement, value);
	else
	{
		if (strcmp (attribute, "class") == 0)
			attribute = "className";
		IHTMLElement *e;
		HRESULT hr = m_pElement->QueryInterface(IID_IHTMLElement, reinterpret_cast<void**>(&e));
		if (!FAILED(hr) && e != NULL)
		{
			BSTR bstrAttribute = Utils::str2bstr(attribute);
			BSTR bstrValue = Utils::str2bstr(value);
			VARIANT v;
			v.vt = VT_BSTR;
			v.bstrVal = bstrValue;
			hr = e->setAttribute(bstrAttribute, v,  1 /* respecte case*/);
			SysFreeString(bstrValue);
			SysFreeString(bstrAttribute);
			e->Release();
		}
	}
}