bool LoadXMLDoc(LPCWSTR file, BDADEVICES& d) { IXMLDOMDocumentPtr Document; HRESULT hr; d.reset(); hr = Document.CreateInstance(CLSID_DOMDocument30); if(hr==S_OK) { VARIANT_BOOL success; hr = Document->load(_variant_t(file),&success); if(hr==S_OK&&success==VARIANT_TRUE) { IXMLDOMElementPtr root; IXMLDOMElementPtr bda_source; IXMLDOMElementPtr bda_reciever; IXMLDOMNodePtr bda_source_node; IXMLDOMNodePtr bda_reciever_node; hr = Document->get_documentElement(&root); hr = root->selectSingleNode(_bstr_t(L"kscategory_bda_network_tuner"),&bda_source_node); hr = root->selectSingleNode(_bstr_t(L"kscategory_bda_receiver_component"),&bda_reciever_node); bda_source = bda_source_node; bda_reciever = bda_reciever_node; GetDeviceList(bda_source,d.bda_source); GetDeviceList(bda_reciever,d.bda_reciever); } else { return false; } } else { return false; } return false; }
void CText::Load(IXMLDOMElementPtr pGO) { IXMLDOMElementPtr pStatic; IXMLDOMElementPtr pDynamic; IXMLDOMElementPtr pAttr; _variant_t val; pStatic=pGO->selectSingleNode(L"./static"); //position pAttr=pStatic->selectSingleNode(L"./position"); //x1 val=pAttr->getAttribute(L"x1"); val.ChangeType(VT_I4); m_lx1=val.lVal; //y1 val=pAttr->getAttribute(L"y1"); val.ChangeType(VT_I4); m_ly1=val.lVal; //x2 val=pAttr->getAttribute(L"x2"); val.ChangeType(VT_I4); m_lx2=val.lVal; //y2 val=pAttr->getAttribute(L"y2"); val.ChangeType(VT_I4); m_ly2=val.lVal; //face color pAttr=pStatic->selectSingleNode(L"./color"); //color val=pAttr->getAttribute(L"c"); val.ChangeType(VT_UI4); m_FaceColor=val.ulVal; //font pAttr=pStatic->selectSingleNode(L"./font"); //lfHeight val=pAttr->getAttribute(L"h"); val.ChangeType(VT_I4); m_font.lfHeight=val.ulVal; //lfWidth val=pAttr->getAttribute(L"wd"); val.ChangeType(VT_I4); m_font.lfWidth=val.ulVal; //lfEscapement val=pAttr->getAttribute(L"e"); val.ChangeType(VT_I4); m_font.lfEscapement=val.ulVal; //lfOrientation val=pAttr->getAttribute(L"o"); val.ChangeType(VT_I4); m_font.lfOrientation=val.ulVal; //lfWeight val=pAttr->getAttribute(L"wg"); val.ChangeType(VT_I4); m_font.lfWeight=val.ulVal; //lfItalic val=pAttr->getAttribute(L"i"); val.ChangeType(VT_UI1); m_font.lfItalic=val.ulVal; //lfUnderline val=pAttr->getAttribute(L"u"); val.ChangeType(VT_UI1); m_font.lfUnderline=val.ulVal; //lfStrikeOut val=pAttr->getAttribute(L"so"); val.ChangeType(VT_UI1); m_font.lfStrikeOut=val.ulVal; //lfCharSet val=pAttr->getAttribute(L"cs"); val.ChangeType(VT_UI1); m_font.lfCharSet=val.ulVal; //lfOutPrecision val=pAttr->getAttribute(L"op"); val.ChangeType(VT_UI1); m_font.lfOutPrecision=val.ulVal; //lfClipPrecision val=pAttr->getAttribute(L"cp"); val.ChangeType(VT_UI1); m_font.lfClipPrecision=val.ulVal; //lfQuality val=pAttr->getAttribute(L"q"); val.ChangeType(VT_UI1); m_font.lfQuality=val.ulVal; //lfPitchAndFamily val=pAttr->getAttribute(L"paf"); val.ChangeType(VT_UI1); m_font.lfPitchAndFamily=val.ulVal; //lfFaceName val=pAttr->getAttribute(L"fn"); CString strFaceName=val.bstrVal; sprintf(m_font.lfFaceName,"%s",(LPCTSTR)strFaceName); //text pAttr=pStatic->selectSingleNode(L"./text"); val=pAttr->getAttribute(L"t"); m_text=val.bstrVal; //load dynamic attribution if have pDynamic=pGO->selectSingleNode(L"./dynamic"); val=pDynamic->getAttribute(L"linked"); val.ChangeType(VT_BOOL); if(val.boolVal){ m_DnyAttr.Load(pDynamic); m_DnyAttr.m_Linked=true; }else{ m_DnyAttr.m_Linked=false; } }
void CLine::Load(IXMLDOMElementPtr pGO) { IXMLDOMElementPtr pStatic; IXMLDOMElementPtr pDynamic; IXMLDOMElementPtr pAttr; _variant_t val; pStatic=pGO->selectSingleNode(L"./static"); //position pAttr=pStatic->selectSingleNode(L"./position"); //x1 val=pAttr->getAttribute(L"x1"); val.ChangeType(VT_I4); m_lx1=val.lVal; //y1 val=pAttr->getAttribute(L"y1"); val.ChangeType(VT_I4); m_ly1=val.lVal; //x2 val=pAttr->getAttribute(L"x2"); val.ChangeType(VT_I4); m_lx2=val.lVal; //y2 val=pAttr->getAttribute(L"y2"); val.ChangeType(VT_I4); m_ly2=val.lVal; m_loy1=m_ly1; m_loy2=m_ly2; m_lox1=m_lx1; m_lox2=m_lx2; /* if(m_lx1<m_lx2){ m_lox1=m_lx1; m_lox2=m_lx2; }else{ m_lox1=m_lx2; m_lox2=m_lx1; m_lx1=m_lox1; m_lx2=m_lox2; } if(m_ly1<m_ly2){ m_loy1=m_ly1; m_loy2=m_ly2; }else{ m_loy1=m_ly2; m_loy2=m_ly1; m_ly1=m_loy1; m_ly2=m_loy2; } */ //pen pAttr=pStatic->selectSingleNode(L"./pen"); //style val=pAttr->getAttribute(L"s"); val.ChangeType(VT_UI4); m_pen.lopnStyle=val.ulVal; //width val=pAttr->getAttribute(L"w"); val.ChangeType(VT_I4); m_pen.lopnWidth.x=val.lVal; //color val=pAttr->getAttribute(L"c"); val.ChangeType(VT_UI4); m_pen.lopnColor=val.ulVal; m_open=m_pen; //load dynamic attribution if have pDynamic=pGO->selectSingleNode(L"./dynamic"); val=pDynamic->getAttribute(L"linked"); val.ChangeType(VT_BOOL); if(val.boolVal) { m_DnyAttr.Load(pDynamic); m_DnyAttr.m_Linked=true; } else { m_DnyAttr.m_Linked=false; } }