|  |  | 
 |  |  | class __declspec(dllexport) vindexform: public xwin | 
 |  |  | { | 
 |  |  | public: | 
 |  |  |    string m_Assignment; | 
 |  |  |    xstring m_Assignment; | 
 |  |  |    HWND m_hMenu; | 
 |  |  |    xlayersheet mainsheet; | 
 |  |  |    xcombobox cbx_menu; | 
 |  |  |    xcombobox cbx_panelName; | 
 |  |  |    xcombobox cbx_panelNo; | 
 |  |  |    xcombobox cbx_tab; | 
 |  |  |    xcombobox cbx_menu; //页签数组 | 
 |  |  |    xcombobox cbx_panelName; //页签顺序数组 | 
 |  |  |    xcombobox cbx_panelNo; //页签数组 | 
 |  |  |    xcombobox cbx_tab; //页签顺序数组 | 
 |  |  |  | 
 |  |  |     | 
 |  |  |    xcombobox memuId; //页签数组 | 
 |  |  |    xcombobox tabNo; //页签顺序数组 | 
 |  |  |    xcombobox panelNo; //页签数组 | 
 |  |  |    xcombobox panelName; //页签顺序数组 | 
 |  |  |  | 
 |  |  |    HWND m_npHwnd; //菜单树窗口句柄 | 
 |  |  |    HWND m_nHwnd; //菜单树窗口句柄 | 
 |  |  |    int m_cursheet; //当前页签 | 
 |  |  | 
 |  |  |       xml x ; | 
 |  |  |       x.load(L"cache\\config.xml"); | 
 |  |  |       //alert(x.GetXml()); | 
 |  |  |       if (x.xml() == L"") return L""; | 
 |  |  |       if ((xstring)x.xml() == L"") return L""; | 
 |  |  |       KXMLDOMElement e = x.documentElement(); | 
 |  |  |       if (e.selectSingleNode(L"home")) | 
 |  |  |       { | 
 |  |  | 
 |  |  |    { | 
 |  |  |       xml x ; | 
 |  |  |       x.load(L"cache\\config.xml"); | 
 |  |  |       if (x.xml() == L"") | 
 |  |  |       if ((xstring)x.xml() == L"") | 
 |  |  |       { | 
 |  |  |          //alert(L"<config><home "+att+L"=L"+value+L"/></config>"); | 
 |  |  |          //alert(L"<config><home "+att+L"="+value+L"/></config>"); | 
 |  |  |          x.loadXML(L"<config><home " + att + L"='" + value + L"'/></config>"); | 
 |  |  |       } | 
 |  |  |       else | 
 |  |  |       { | 
 |  |  |          KXMLDOMElement e = x.documentElement(); | 
 |  |  |          if (e.selectSingleNode(L"home")) | 
 |  |  |          if (e) | 
 |  |  |          { | 
 |  |  |             KXMLDOMElement e1 = e.selectSingleNode(L"home"); | 
 |  |  |             e1.setAttribute(att, value); | 
 |  |  |          } | 
 |  |  |          else | 
 |  |  |          { | 
 |  |  |             KXMLDOMElement e2 = x.createElement(L"home"); | 
 |  |  |             e2.setAttribute(att, value); | 
 |  |  |             e.appendChild(e2); | 
 |  |  |             if (e.selectSingleNode(L"home")) | 
 |  |  |             { | 
 |  |  |                KXMLDOMElement e1 = e.selectSingleNode(L"home"); | 
 |  |  |                e1.setAttribute(att, value); | 
 |  |  |             } | 
 |  |  |             else | 
 |  |  |             { | 
 |  |  |                KXMLDOMElement e2 = x.createElement(L"home"); | 
 |  |  |                e2.setAttribute(att, value); | 
 |  |  |                e.appendChild(e2); | 
 |  |  |             } | 
 |  |  |          } | 
 |  |  |          //alert(e.xml); | 
 |  |  |       } | 
 |  |  | 
 |  |  |       if (!hMenu) | 
 |  |  |       { | 
 |  |  |          HWND hw = m_hMenu; | 
 |  |  |          bool f = IsWindow(hw); | 
 |  |  |  | 
 |  |  |          if (hw == 0 && f <= 0) | 
 |  |  |          bool bwin = hw ? IsWindow(hw):false; | 
 |  |  |          if (!bwin) | 
 |  |  |          { | 
 |  |  |             xaserverarg* arg = new xaserverarg(); | 
 |  |  |             HWND hWnd = GetHWND(); | 
 |  |  |             arg->SetParam(L"hwnd", (LPARAM)hWnd); | 
 |  |  |             arg->SetParam(L"memuId", (LPARAM)cbx_menu.getNativePointer()); | 
 |  |  |             arg->SetParam(L"tabNo", (LPARAM)cbx_tab.getNativePointer()); | 
 |  |  |             arg->SetParam(L"panelNo", (LPARAM)cbx_panelNo.getNativePointer()); | 
 |  |  |             arg->SetParam(L"panelName", (LPARAM)cbx_panelName.getNativePointer()); | 
 |  |  |             arg->SetParam(L"cbx_menu", (LPARAM)cbx_menu.getNativePointer()); | 
 |  |  |             arg->SetParam(L"cbx_tab", (LPARAM)cbx_tab.getNativePointer()); | 
 |  |  |             arg->SetParam(L"cbx_panelNo", (LPARAM)cbx_panelNo.getNativePointer()); | 
 |  |  |             arg->SetParam(L"cbx_panelName", (LPARAM)cbx_panelName.getNativePointer()); | 
 |  |  |             xwin* pwin = OpenWindow(L"dev:xpage[vindexmenu.vx]", (LPARAM)arg); | 
 |  |  |             m_hMenu = pwin->GetHWND(); | 
 |  |  |             hw = m_hMenu; | 
 |  |  | 
 |  |  |             xaserverarg* arg = new xaserverarg(); | 
 |  |  |             HWND hWnd = GetHWND(); | 
 |  |  |             arg->SetParam(L"hwnd", (LPARAM)hWnd); | 
 |  |  |             arg->SetParam(L"memuId", (LPARAM)cbx_menu.getNativePointer()); | 
 |  |  |             arg->SetParam(L"tabNo", (LPARAM)cbx_tab.getNativePointer()); | 
 |  |  |             arg->SetParam(L"cbx_menu", (LPARAM)cbx_menu.getNativePointer()); | 
 |  |  |             arg->SetParam(L"cbx_tab", (LPARAM)cbx_tab.getNativePointer()); | 
 |  |  |             arg->SetParam(L"panelNo", (LPARAM)cbx_panelNo.getNativePointer()); | 
 |  |  |             arg->SetParam(L"panelName", (LPARAM)cbx_panelName.getNativePointer()); | 
 |  |  |             xwin* pwin=OpenWindow(L"dev:xpage[vindexmenu.vx]", (LPARAM)arg); | 
 |  |  | 
 |  |  |          OnMenu(NULL); | 
 |  |  |       } | 
 |  |  |       menuShow = -1 - isshow; | 
 |  |  |       xcombobox::SetCurSel(memuId.GetHWND(), menuShow); | 
 |  |  |       cbx_menu.SetCurSel(menuShow); | 
 |  |  |       if (f != L"") | 
 |  |  |          setHomeConfig(L"menuposition", xstring(menuShow)); | 
 |  |  |       return 1; | 
 |  |  | 
 |  |  |  | 
 |  |  |    int ResetMenu() | 
 |  |  |    { | 
 |  |  |       ::DestroyWindow(m_hMenu); | 
 |  |  |       m_hMenu = 0; | 
 |  |  |       return 1; | 
 |  |  |  | 
 |  |  |       //if(m_nHwnd) xwin::CloseWindow(m_nHwnd); | 
 |  |  |       m_nHwnd = 0; | 
 |  |  |       OnMenu(NULL); | 
 |  |  |       OnMenuAgent(L""); | 
 |  |  |  | 
 |  |  | #if 0 | 
 |  |  |       menuShow = -1; | 
 |  |  |       xstring f = getHomeConfig(L"menuposition"); | 
 |  |  |       if (f == L"0") | 
 |  |  | 
 |  |  |          OnMenuAgent(L""); | 
 |  |  |       } | 
 |  |  |  | 
 |  |  |  | 
 |  |  |       xaserverarg arg; | 
 |  |  |     | 
 |  |  |       HWND h = GetHWND(); | 
 |  |  | 
 |  |  |       arg.SetParam(L"hwnd", h); | 
 |  |  |        | 
 |  |  |       OpenWindow(L"dev:xpage[vindexforold.vx]", arg); | 
 |  |  |  | 
 |  |  | #endif | 
 |  |  |       return 1; | 
 |  |  |    } | 
 |  |  |  | 
 |  |  |    int ReSetInfo() | 
 |  |  |    { | 
 |  |  |        | 
 |  |  |       memuId.ResetContent(); | 
 |  |  |       tabNo.ResetContent(); | 
 |  |  |       panelNo.ResetContent(); | 
 |  |  |       panelName.ResetContent(); | 
 |  |  |       cbx_menu.ResetContent(); | 
 |  |  |       cbx_tab.ResetContent(); | 
 |  |  |       cbx_panelNo.ResetContent(); | 
 |  |  |       cbx_panelName.ResetContent(); | 
 |  |  |  | 
 |  |  |       int hItem = mainsheet.GetSheetCount(); | 
 |  |  |       while (hItem > 1) | 
 |  |  | 
 |  |  |          //trace(x.GetXml()); | 
 |  |  |          return -1; | 
 |  |  |       } | 
 |  |  |       if (x.xml() == L"") return -1; | 
 |  |  |       if ((xstring)x.xml() == L"") return -1; | 
 |  |  |       KXMLDOMElement e = x.documentElement(); | 
 |  |  |       if (/*m_Assignment == L"" &&*/ e.selectSingleNode(L"AssignmentID")) | 
 |  |  |       { | 
 |  |  | 
 |  |  |       if (m_Assignment == L"") | 
 |  |  |          alert(L"获取用户数据失败,请重新登录!"); | 
 |  |  |       else | 
 |  |  |          xaserver::SetUID((LPWSTR)m_Assignment); | 
 |  |  |          xaserver::SetUID((LPWSTR)m_Assignment.c_str(true)); | 
 |  |  |  | 
 |  |  |       xcombobox::AddItem(memuId.GetHWND(), L"开始"); | 
 |  |  |       xcombobox::AddItem(tabNo.GetHWND(), L"-1"); | 
 |  |  |       xcombobox::AddItem(cbx_menu.GetHWND(), L"开始"); | 
 |  |  |       xcombobox::AddItem(cbx_tab.GetHWND(), L"-1"); | 
 |  |  |       //OpenWindow(L"dev:xpage[vstart.vx]"); | 
 |  |  |       xcontrol xc = GetControl(L"statusbar0"); | 
 |  |  |       xc.SetText(L"正在初始化系统,请稍候...."); | 
 |  |  | 
 |  |  |          trace(x.xml()); | 
 |  |  |          return -1; | 
 |  |  |       } | 
 |  |  |       if (x.xml() == L"") return -1; | 
 |  |  |       if ((xstring)x.xml() == L"") return -1; | 
 |  |  |       KXMLDOMElement e = x.documentElement(); | 
 |  |  |       KXMLDOMNodeList li = e.selectNodes(L"item"); | 
 |  |  |       int i; | 
 |  |  | 
 |  |  |       int MF_CHECKED = 0x8; | 
 |  |  |  | 
 |  |  |       int k = mainsheet.GetSheetIndex(); | 
 |  |  |       //int cs = xcombobox::GetCount(memuId.GetId()); | 
 |  |  |       //int cs = xcombobox::GetCount(cbx_menu.GetId()); | 
 |  |  |       int cs = mainsheet.GetSheetCount(); | 
 |  |  |       int i; | 
 |  |  |       for (i = 0; i < cs; i++) { | 
 |  |  |          //string str = xcombobox::GetLBText(memuId.GetId(), i); | 
 |  |  |          //xstring str = xcombobox::GetLBText(cbx_menu.GetId(), i); | 
 |  |  |          xstring str = mainsheet.GetSheetText(i); | 
 |  |  |          if (i == k) | 
 |  |  |             AppendMenu(m, MF_STRING | MF_CHECKED, i + 1, str); | 
 |  |  | 
 |  |  |       int sheet = nmtv.nSheet; | 
 |  |  |       int s = mainsheet.GetSheetCount(); | 
 |  |  |       //trace(s); | 
 |  |  |       int cs = xcombobox::GetCount(memuId.GetHWND()); | 
 |  |  |       int cs = xcombobox::GetCount(cbx_menu.GetHWND()); | 
 |  |  |       int cursheet = m_cursheet; | 
 |  |  |  | 
 |  |  |       if (s > cs) { | 
 |  |  |          xcombobox::AddItem(memuId.GetHWND(), L"自由窗口"); | 
 |  |  |          xcombobox::AddItem(tabNo.GetHWND(), xstring(cursheet)); | 
 |  |  |          xcombobox::AddItem(cbx_menu.GetHWND(), L"自由窗口"); | 
 |  |  |          xcombobox::AddItem(cbx_tab.GetHWND(), xstring(cursheet)); | 
 |  |  |       } | 
 |  |  |       if (s < cs) { | 
 |  |  |          xcombobox::DeleteItem(memuId.GetHWND(), cursheet); | 
 |  |  |          xcombobox::DeleteItem(cbx_menu.GetHWND(), cursheet); | 
 |  |  |          int i = 0; | 
 |  |  |          xstring value = xcombobox::GetLBText(tabNo.GetHWND(), cursheet); | 
 |  |  |          xstring value = xcombobox::GetLBText(cbx_tab.GetHWND(), cursheet); | 
 |  |  |          for (i = 0; i < cs; i++) | 
 |  |  |          { | 
 |  |  |             xstring tabId = xcombobox::GetLBText(tabNo.GetHWND(), i); | 
 |  |  |             xstring tabId = xcombobox::GetLBText(cbx_tab.GetHWND(), i); | 
 |  |  |             if (tabId == xstring(cursheet)) | 
 |  |  |             { | 
 |  |  |                xcombobox::DeleteItem(tabNo.GetHWND(), i); | 
 |  |  |                xcombobox::InsertString(tabNo.GetHWND(), i, value); | 
 |  |  |                xcombobox::DeleteItem(cbx_tab.GetHWND(), i); | 
 |  |  |                xcombobox::InsertString(cbx_tab.GetHWND(), i, value); | 
 |  |  |             } | 
 |  |  |          } | 
 |  |  |          xcombobox::DeleteItem(tabNo.GetHWND(), cursheet); | 
 |  |  |          xcombobox::DeleteItem(cbx_tab.GetHWND(), cursheet); | 
 |  |  |          if (sheet != value.toInt()) | 
 |  |  |             mainsheet.SelectSheet(value.toInt()); | 
 |  |  |       } | 
 |  |  | 
 |  |  |       Hxsoft::XFrame::KXMLDOMElement e = x.documentElement(); | 
 |  |  |       if((xstring)m_Assignment == L"" && e.selectSingleNode(L"AssignmentID")) | 
 |  |  |       { | 
 |  |  |          string sInfoEx = e.selectSingleNode(L"AssignmentID").text(); | 
 |  |  |          xstring sInfoEx = e.selectSingleNode(L"AssignmentID").text(); | 
 |  |  |          m_Assignment = sInfoEx; | 
 |  |  |       } | 
 |  |  |        | 
 |  |  |       if((xstring)m_Assignment == L"") | 
 |  |  |          alert(L"获取用户数据失败,请重新登录!"); | 
 |  |  |       else | 
 |  |  |          xaserver::SetUID((LPWSTR)m_Assignment); | 
 |  |  |          xaserver::SetUID((LPWSTR)m_Assignment.c_str(true)); | 
 |  |  |       return 1; | 
 |  |  |    } | 
 |  |  |  | 
 |  |  | 
 |  |  |    int Initial() | 
 |  |  |    { | 
 |  |  |       SetUserID(); | 
 |  |  |       xstring userno = xaserver::GetUserNo(); | 
 |  |  |       if (userno == L"admin") | 
 |  |  |       { | 
 |  |  |          xnode anode = GetAgentNode(L"dev"); | 
 |  |  |          int LayerFlow_WE_ = 0x00000002; | 
 |  |  |          int LayerFlow_Control_ = 0x00000010; | 
 |  |  |          anode.SetLayerFlow(LayerFlow_WE_ | LayerFlow_Control_); | 
 |  |  |       } | 
 |  |  |       m_Assignment = L""; | 
 |  |  |  | 
 |  |  |       return 1; | 
 |  |  |    } | 
 |  |  |    int onload() | 
 |  |  | 
 |  |  |       Initial(); | 
 |  |  |  | 
 |  |  |       OnAttachListon(); | 
 |  |  |       OpenWindow(L"dev:xpage[start.vframe.vbusiness.vx]"); | 
 |  |  |     | 
 |  |  |       return 1; | 
 |  |  |    } | 
 |  |  |     | 
 |  |  |    int onloaded() | 
 |  |  |    { | 
 |  |  |       ReSetInfo(); | 
 |  |  |       //OpenWindow("dev:xpage[start.vframe.vbusiness.vx]"); | 
 |  |  |       //xwin* lw_face = OpenWindow(L"dev:xpage[start.vframe.vbusiness.vx]"); | 
 |  |  |       xwin* lw_face = OpenWindow(L"dev:xpage[Business5.vx]"); | 
 |  |  |       if(lw_face)m_startwin = lw_face->GetHWND(); | 
 |  |  |       cbx_panelName.SetCurSel( -1); | 
 |  |  |       ResetMenu(); | 
 |  |  |  | 
 |  |  |       return 1; | 
 |  |  |    } | 
 |  |  |  | 
 |  |  |  | 
 |  |  | }; |