|  |  | 
 |  |  | #include "wobject/xaserver.hpp" | 
 |  |  | #include "xcontrol/xcombobox.hpp" | 
 |  |  | #include "xcontrol/xlayersheet.hpp" | 
 |  |  |  #include "vbusiness/vframe/frame.vframe.vbusiness.hpp" | 
 |  |  |  | 
 |  |  |  | 
 |  |  | using xml = KXMLDOMDocument; | 
 |  |  | 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; //页签顺序数组 | 
 |  |  |  | 
 |  |  | 	 | 
 |  |  |    HWND m_npHwnd; //菜单树窗口句柄 | 
 |  |  |    HWND m_nHwnd; //菜单树窗口句柄 | 
 |  |  |    int m_cursheet; //当前页签 | 
 |  |  |    int menuShow; | 
 |  |  |  | 
 |  |  |    HWND m_npHwnd2; //openwindow | 
 |  |  |    HWND m_startwin; | 
 |  |  |  | 
 |  |  | public: | 
 |  |  |    vindexform(void* implPtr,HWND hWnd):xwin(implPtr,hWnd){} | 
 |  |  | public: | 
 |  |  |    static vindexform * CreateInstance(void* implPtr,void* hWnd) | 
 |  |  |    { | 
 |  |  |       vindexform* pWin = new vindexform(implPtr,(HWND)hWnd); | 
 |  |  |       return pWin; | 
 |  |  |       return  new vindexform(implPtr,(HWND)hWnd); | 
 |  |  |    } | 
 |  |  | public: | 
 |  |  |  | 
 |  |  |  | 
 |  |  |    xstring getHomeConfig(xstring att) | 
 |  |  |    { | 
 |  |  |       xml x ; | 
 |  |  |       x.load(L"cache\\config.xml"); | 
 |  |  |       //alert(x.GetXml()); | 
 |  |  |       if ((xstring)x.xml() == L"") return L""; | 
 |  |  |       KXMLDOMElement e = x.documentElement(); | 
 |  |  |       if (e.selectSingleNode(L"home")) | 
 |  |  |       { | 
 |  |  |          KXMLDOMElement e1 = e.selectSingleNode(L"home"); | 
 |  |  |          if (e1.selectSingleNode(L"@" + att)) | 
 |  |  |             return e1.selectSingleNode(L"@" + att).text(); | 
 |  |  |       } | 
 |  |  |       return L""; | 
 |  |  |    } | 
 |  |  |  | 
 |  |  |    int setHomeConfig(xstring att, xstring value) | 
 |  |  |    { | 
 |  |  |       xml x ; | 
 |  |  |       x.load(L"cache\\config.xml"); | 
 |  |  |       if ((xstring)x.xml() == L"") | 
 |  |  |       { | 
 |  |  |          //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) | 
 |  |  |          { | 
 |  |  |             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); | 
 |  |  |       } | 
 |  |  |       //alert(x.GetXml()); | 
 |  |  |       xutil::SaveToFile(L"cache\\config.xml", x.xml(), L"", L"", (LPTSTR)L""); | 
 |  |  |       return 1; | 
 |  |  |    } | 
 |  |  |  | 
 |  |  |    int OnDWClick(TEvent* evt, int p) | 
 |  |  |    { | 
 |  |  |       alert(L"clicked"); | 
 |  |  |       return 1; | 
 |  |  |    } | 
 |  |  |  | 
 |  |  |    int OnMenu(HWND hMenu) | 
 |  |  |    { | 
 |  |  |       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()); | 
 |  |  |             xwin* pwin=OpenWindow(L"dev:xpage[vindexmenu.vx]", (LPARAM)arg); | 
 |  |  |             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; | 
 |  |  |             //return 1; | 
 |  |  |          } | 
 |  |  |          HWND HWND_TOPMOST = (HWND) - 1; | 
 |  |  |          HWND HWND_NOTOPMOST =(HWND)-2; | 
 |  |  |          HWND HWND_TOPMOST = (HWND)-1; | 
 |  |  |          HWND HWND_NOTOPMOST = (HWND)-2; | 
 |  |  |          int SWP_NOSIZE = 0x0001; | 
 |  |  |          int SWP_NOMOVE = 0x0002; | 
 |  |  |          int SWP_SHOWWINDOW = 0x0040; | 
 |  |  | 
 |  |  |       int t2 = r.top; | 
 |  |  |       int b2 = r.bottom; | 
 |  |  |  | 
 |  |  |       MoveWindow(m_hMenu, l - 7, b, 220, b2 - t2, false); | 
 |  |  |       MoveWindow(m_hMenu, l - 7, b, 220, b2 - t2, true); | 
 |  |  |  | 
 |  |  |       return 1; | 
 |  |  |    } | 
 |  |  |  | 
 |  |  |    int OnMenu1(xstring hMenu) | 
 |  |  |    { | 
 |  |  |       if (!hMenu) | 
 |  |  |       { | 
 |  |  |          HWND hw = m_hMenu; | 
 |  |  |          bool f = IsWindow(hw); | 
 |  |  |  | 
 |  |  |          if (hw == 0 && f <= 0) | 
 |  |  |          { | 
 |  |  |             xaserverarg* arg = new xaserverarg(); | 
 |  |  |             HWND hWnd = GetHWND(); | 
 |  |  |             arg->SetParam(L"hwnd", (LPARAM)hWnd); | 
 |  |  |             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); | 
 |  |  |             m_hMenu = pwin->GetHWND(); | 
 |  |  |             hw = m_hMenu; | 
 |  |  |             //return 1; | 
 |  |  |          } | 
 |  |  |          HWND HWND_TOPMOST = (HWND) - 1; | 
 |  |  |          HWND HWND_NOTOPMOST =(HWND)-2; | 
 |  |  |          int SWP_NOSIZE = 0x0001; | 
 |  |  |          int SWP_NOMOVE = 0x0002; | 
 |  |  |          int SWP_SHOWWINDOW = 0x0040; | 
 |  |  |          SetWindowPos(hw, HWND_TOPMOST, -1000, -1000, 0, 0, SWP_NOSIZE | SWP_SHOWWINDOW); | 
 |  |  |       } | 
 |  |  |       else | 
 |  |  |       { | 
 |  |  |          m_hMenu = (HWND)hMenu.toInt64(); | 
 |  |  |       } | 
 |  |  |  | 
 |  |  |       xrect xr; | 
 |  |  |       xcontrol xc = GetControl(L"xmMenu"); | 
 |  |  |       GetWindowRect(xc.GetHWND(), xr); | 
 |  |  |       int l = xr.left; | 
 |  |  |       int b = xr.bottom; | 
 |  |  |  | 
 |  |  |       xrect r; | 
 |  |  |       xc = GetControl(L"split"); | 
 |  |  |       GetWindowRect(xc.GetHWND(), r); | 
 |  |  |       int t2 = r.top; | 
 |  |  |       int b2 = r.bottom; | 
 |  |  |  | 
 |  |  |       MoveWindow(m_hMenu, l - 7, b, 220, b2 - t2, true); | 
 |  |  | 		 | 
 |  |  |       return 1; | 
 |  |  |    } | 
 |  |  |    int OnMenuAgent(xstring f) | 
 |  |  |    { | 
 |  |  |       //int LayerFlow_None = 0x00000001; | 
 |  |  |       //int LayerFlow_UnLayer = 0x00000100; | 
 |  |  |       //int LayerFlow_NS = 0x00000004; | 
 |  |  |       //int LayerFlow_Control = 0x00000010; | 
 |  |  |       int GWL_STYLE = -16; | 
 |  |  |       int WS_POPUP = 0x80000000; | 
 |  |  |       int WS_CHILD = 0x40000000; | 
 |  |  |       int WS_MAXIMIZE = 0x00010000; | 
 |  |  |       int SW_MAXIMIZE = 3; | 
 |  |  |       HWND HWND_TOPMOST = (HWND) - 1; | 
 |  |  |       HWND HWND_NOTOPMOST = (HWND) - 2; | 
 |  |  |       int SWP_NOSIZE = 0x0001; | 
 |  |  |       int SWP_NOMOVE = 0x0002; | 
 |  |  |       int SWP_SHOWWINDOW = 0x0040; | 
 |  |  |       SetWindowPos(m_nHwnd, HWND_TOPMOST, -1000, -1000, 0, 0, SWP_NOSIZE | SWP_SHOWWINDOW); | 
 |  |  |       int style = GetWindowLong(m_nHwnd, GWL_STYLE); | 
 |  |  |       xnode anode = GetAgentNode(L"menuAgent"); | 
 |  |  |       xnode bnode = GetAgentNode(L"xmMenu"); | 
 |  |  |       int isshow = menuShow; | 
 |  |  |       if (isshow == -1) | 
 |  |  |       { | 
 |  |  |          anode.SetLayerFlow(LayerFlow_NS | LayerFlow_Control); | 
 |  |  |          bnode.SetLayerFlow(LayerFlow_None | LayerFlow_UnLayer); | 
 |  |  |  | 
 |  |  |          style = style - WS_POPUP; | 
 |  |  |          style = style + WS_CHILD; | 
 |  |  |          SetWindowLong(m_nHwnd, GWL_STYLE, style); | 
 |  |  |  | 
 |  |  |          m_npHwnd = GetParent(m_nHwnd); | 
 |  |  |          xcontrol xc = GetControl(L"menuAgent"); | 
 |  |  |          SetParent(m_nHwnd, xc.GetHWND()); | 
 |  |  |          ShowWindow(m_nHwnd, SW_MAXIMIZE); | 
 |  |  |  | 
 |  |  |          ///AttachEvent(L"WM_SIZE",OnMenuSizeChanged);	 | 
 |  |  |          //AttachEvent(L"WM_PAINT",OnMenuSizeChanged);	 | 
 |  |  |          //AttachEvent(L"WM_WINDOWPOSCHANGED",OnMenuSizeChanged);	 | 
 |  |  |       } | 
 |  |  |       else | 
 |  |  |       { | 
 |  |  |          bnode.SetLayerFlow(LayerFlow_NS | LayerFlow_Control); | 
 |  |  |          anode.SetLayerFlow(LayerFlow_None | LayerFlow_UnLayer); | 
 |  |  |  | 
 |  |  |          style = style + WS_POPUP; | 
 |  |  |          style = style - WS_CHILD; | 
 |  |  |          SetWindowLong(m_nHwnd, GWL_STYLE, style); | 
 |  |  |          SetParent(m_nHwnd, m_npHwnd); | 
 |  |  |          OnMenu(NULL); | 
 |  |  |       } | 
 |  |  |       menuShow = -1 - isshow; | 
 |  |  |       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") | 
 |  |  |       { | 
 |  |  |          OnMenu(NULL); | 
 |  |  |          OnMenuAgent(L""); | 
 |  |  |       } | 
 |  |  |  | 
 |  |  |  | 
 |  |  |       xaserverarg arg; | 
 |  |  | 	 | 
 |  |  |       HWND h = GetHWND(); | 
 |  |  |       //arg.AddArg(L"hwnd", xstring(h)); | 
 |  |  |       arg.SetParam(L"hwnd", h); | 
 |  |  | 		 | 
 |  |  |       OpenWindow(L"dev:xpage[vindexforold.vx]", arg); | 
 |  |  | #endif | 
 |  |  |       return 1; | 
 |  |  |    } | 
 |  |  |  | 
 |  |  |    int ReSetInfo() | 
 |  |  |    { | 
 |  |  | 		 | 
 |  |  |       cbx_menu.ResetContent(); | 
 |  |  |       cbx_tab.ResetContent(); | 
 |  |  |       cbx_panelNo.ResetContent(); | 
 |  |  |       cbx_panelName.ResetContent(); | 
 |  |  |  | 
 |  |  |       int hItem = mainsheet.GetSheetCount(); | 
 |  |  |       while (hItem > 1) | 
 |  |  |       { | 
 |  |  |          //mainsheet.DeleteSheet(hItem - 1); | 
 |  |  |          SendMessage(GetHWND(), 0x401, (WPARAM)L"xmSheetClose", 0); | 
 |  |  |          hItem = mainsheet.GetSheetCount(); | 
 |  |  |       } | 
 |  |  |  | 
 |  |  |       xml x; | 
 |  |  | 		 | 
 |  |  |       xaserverarg arg; | 
 |  |  | 		 | 
 |  |  |       arg.AddArg(L"Assignment", m_Assignment); | 
 |  |  |       //alert(arg.GetString()); | 
 |  |  |       if (xaserver::ExecXQuery(GetServerUrl(), L"[GetSysInfo.xq]", arg.GetString(), x) != 1) | 
 |  |  |       { | 
 |  |  |          //trace(x.GetXml()); | 
 |  |  |          return -1; | 
 |  |  |       } | 
 |  |  |       if ((xstring)x.xml() == L"") return -1; | 
 |  |  |       KXMLDOMElement e = x.documentElement(); | 
 |  |  |       if (/*m_Assignment == L"" &&*/ e.selectSingleNode(L"AssignmentID")) | 
 |  |  |       { | 
 |  |  |          xstring sInfoEx = e.selectSingleNode(L"AssignmentID").text(); | 
 |  |  |          m_Assignment = sInfoEx; | 
 |  |  |       } | 
 |  |  |  | 
 |  |  |       if (m_Assignment == L"") | 
 |  |  |          alert(L"获取用户数据失败,请重新登录!"); | 
 |  |  |       else | 
 |  |  |          xaserver::SetUID((LPWSTR)m_Assignment.c_str(true)); | 
 |  |  |  | 
 |  |  |       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"正在初始化系统,请稍候...."); | 
 |  |  |       HCURSOR hCursor = xutil::SetCursorWait(); | 
 |  |  |       if (e.selectSingleNode(L"name")) | 
 |  |  |       { | 
 |  |  |          xstring sInfo = e.selectSingleNode(L"name").text(); | 
 |  |  |          xc.SetText(sInfo + L"  系统版本:" + xaserver::GetVersion()); | 
 |  |  |       } | 
 |  |  |  | 
 |  |  |       ResetMenu(); | 
 |  |  |       xutil::RestoreCursor(hCursor); | 
 |  |  |       return 1; | 
 |  |  |    } | 
 |  |  |  | 
 |  |  |    int OnChangeLogin() | 
 |  |  |    { | 
 |  |  |       xml x; | 
 |  |  | 		 | 
 |  |  |       xaserverarg arg ; | 
 |  |  | 		 | 
 |  |  |       arg.AddArg(L"userno", xaserver::GetUserNo()); | 
 |  |  |       if (xaserver::ExecXQuery(GetServerUrl(), L"[GetSysAssignment.xq]", arg.GetString(), x) != 1) | 
 |  |  |       { | 
 |  |  |          trace(x.xml()); | 
 |  |  |          return -1; | 
 |  |  |       } | 
 |  |  |       if ((xstring)x.xml() == L"") return -1; | 
 |  |  |       KXMLDOMElement e = x.documentElement(); | 
 |  |  |       KXMLDOMNodeList li = e.selectNodes(L"item"); | 
 |  |  |       int i; | 
 |  |  |       int s = li.length(); | 
 |  |  |       xstring sInfo = m_Assignment; | 
 |  |  |       if (s > 0) | 
 |  |  |       { | 
 |  |  |          HMENU m = CreatePopupMenu(); | 
 |  |  |          int MF_STRING = 0x00000000; | 
 |  |  |          int MF_DISABLED = 0x00000002; | 
 |  |  |          int TPM_RIGHTBUTTON = 0x0002; | 
 |  |  |          int TPM_RETURNCMD = 0x0100; | 
 |  |  |          int MF_CHECKED = 0x8; | 
 |  |  |          for (i = 0; i < s; i++) | 
 |  |  |          { | 
 |  |  |             KXMLDOMElement xitem = li.item(i); | 
 |  |  |             xstring id = xitem.selectSingleNode(L"AssignmentID").text(); | 
 |  |  |             xstring name = xitem.selectSingleNode(L"PositionName").text(); | 
 |  |  |             if (sInfo == id) | 
 |  |  |                AppendMenu(m, MF_STRING | MF_CHECKED, i + 1, name); | 
 |  |  |             else | 
 |  |  |                AppendMenu(m, MF_STRING, i + 1, name); | 
 |  |  |          } | 
 |  |  |          RECT xr; | 
 |  |  |          xpoint pt; | 
 |  |  |          GetCursorPos(pt); | 
 |  |  |          int res = TrackPopupMenu(m, TPM_RIGHTBUTTON | TPM_RETURNCMD, pt.x, pt.y, 0, GetHWND(), &xr); | 
 |  |  |          if (res == 0) return 0; | 
 |  |  |          KXMLDOMElement ele = li.item(res - 1); | 
 |  |  |          xstring sInfoEx = ele.selectSingleNode(L"AssignmentID").text(); | 
 |  |  |          if (m_Assignment == sInfoEx) return 0; | 
 |  |  |          m_Assignment = sInfoEx; | 
 |  |  |          ReSetInfo(); | 
 |  |  |          /*if(m_nHwnd) | 
 |  |  |          { | 
 |  |  |             win32::CloseWindow(m_nHwnd); | 
 |  |  |          }*/ | 
 |  |  |       } | 
 |  |  |       return 1; | 
 |  |  |    } | 
 |  |  |  | 
 |  |  |    int OnAllCaption() | 
 |  |  |    { | 
 |  |  |       HMENU m = CreatePopupMenu(); | 
 |  |  |       int MF_STRING = 0x00000000; | 
 |  |  |       int MF_DISABLED = 0x00000002; | 
 |  |  |       int TPM_RIGHTBUTTON = 0x0002; | 
 |  |  |       int TPM_RETURNCMD = 0x0100; | 
 |  |  |       int MF_CHECKED = 0x8; | 
 |  |  |  | 
 |  |  |       int k = mainsheet.GetSheetIndex(); | 
 |  |  |       //int cs = xcombobox::GetCount(cbx_menu.GetId()); | 
 |  |  |       int cs = mainsheet.GetSheetCount(); | 
 |  |  |       int i; | 
 |  |  |       for (i = 0; i < cs; 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); | 
 |  |  |          else | 
 |  |  |             AppendMenu(m, MF_STRING, i + 1, str); | 
 |  |  |       } | 
 |  |  |       RECT xr; | 
 |  |  |       xpoint pt; | 
 |  |  |       GetCursorPos(pt); | 
 |  |  |       int res = TrackPopupMenu(m, TPM_RIGHTBUTTON | TPM_RETURNCMD, pt.x, pt.y, 0, GetHWND(), &xr); | 
 |  |  |       if (res == 0) return 0; | 
 |  |  |       int nSheet = mainsheet.GetSheetIndex(); | 
 |  |  |       if (nSheet == (res - 1)) return 0; | 
 |  |  |       mainsheet.SelectSheet(res - 1); | 
 |  |  |       return 0; | 
 |  |  |    } | 
 |  |  |    int OnChangeSheet(xstring sheet) | 
 |  |  |    { | 
 |  |  |       if (sheet == L"") return 0; | 
 |  |  |       int nIndex = sheet.toInt(); | 
 |  |  |       int curIndex = mainsheet.GetSheetIndex(); | 
 |  |  |       if (nIndex == curIndex) | 
 |  |  |          return 0; | 
 |  |  |       mainsheet.SelectSheet(nIndex); | 
 |  |  |       return 1; | 
 |  |  |    } | 
 |  |  |    int OnMenuSizeChanged(TEvent* evt, int p) | 
 |  |  |    { | 
 |  |  |       /*xrect xr33; | 
 |  |  |       xcontrol xc = GetControl(L"menuAgent"); | 
 |  |  |       xwin::GetWindowRect(xc.GetId(), xr33); | 
 |  |  |       int l = xr33.left; | 
 |  |  |       int b = xr33.right; | 
 |  |  |       int xx = b - l;*/ | 
 |  |  |       //alert(xx.toString()); | 
 |  |  |       int isshow = menuShow; | 
 |  |  |       if (isshow == 0) | 
 |  |  |       { | 
 |  |  |          int SW_MAXIMIZE = 3; | 
 |  |  |          xcontrol xc = GetControl(L"menuAgent"); | 
 |  |  |          SetParent(m_nHwnd, xc.GetHWND()); | 
 |  |  |          ShowWindow(m_nHwnd, SW_MAXIMIZE); | 
 |  |  |       } | 
 |  |  |       return 1; | 
 |  |  |    } | 
 |  |  |  | 
 |  |  | #if 0 | 
 |  |  |    int OnOpen(xstring pa) | 
 |  |  |    { | 
 |  |  |       //xwin::SendMessage(m_npHwnd2, 0x401, pa, 0); | 
 |  |  |       //return 1; | 
 |  |  |       /*if(xaserver::GetUserNo() == L"admin") | 
 |  |  |       { | 
 |  |  |          OpenWindow(L"dev:xpage[vstart.vx]"); | 
 |  |  |          return 1; | 
 |  |  |       }*/ | 
 |  |  |  | 
 |  |  |       xaserverarg arg ; | 
 |  |  |       xstring isnew = arg.GetArgString(L"_isNewModule"); | 
 |  |  |       xstring vx = arg.GetArgString(L"_ModuelPage"); | 
 |  |  |       if (isnew == L"Y") | 
 |  |  |       { | 
 |  |  |          if (vx.find(L".vx", 0) > 0 || vx.find(L".xpage", 0) > 0) | 
 |  |  |             OpenWindow(L"dev:xpage[" + vx + L"]", arg); | 
 |  |  |          else | 
 |  |  |             openUrl(vx, p); | 
 |  |  |          return 1; | 
 |  |  |       } | 
 |  |  |       //OpenWindow(L"dev:xpage[vindexforold.vx]", p); | 
 |  |  |       return 1; | 
 |  |  |    } | 
 |  |  |  | 
 |  |  |    int OnOpenForOld(xstring pa) | 
 |  |  |    { | 
 |  |  |       m_npHwnd2 = pa.toInt(); | 
 |  |  |  | 
 |  |  |       int GWL_STYLE = -16; | 
 |  |  |       int WS_POPUP = 0x80000000; | 
 |  |  |       int WS_CHILD = 0x40000000; | 
 |  |  |       int SW_MAXIMIZE = 3; | 
 |  |  |       int style = GetWindowLong(m_npHwnd2, GWL_STYLE); | 
 |  |  |       style = style - WS_POPUP; | 
 |  |  |       style = style + WS_CHILD; | 
 |  |  |       SetWindowLong(m_npHwnd2, GWL_STYLE, style); | 
 |  |  |  | 
 |  |  |       xcontrol xc = GetControl(L"openforold"); | 
 |  |  |       SetParent(m_npHwnd2, xc.GetHWND()); | 
 |  |  |  | 
 |  |  |       ShowWindow(m_npHwnd2, SW_MAXIMIZE); | 
 |  |  |       return 1; | 
 |  |  |    } | 
 |  |  | #endif | 
 |  |  |    int OnHelp() | 
 |  |  |    { | 
 |  |  |       OpenWindow(L"dev:xpage[trade.help3.vx]"); | 
 |  |  |       return 1; | 
 |  |  |    } | 
 |  |  |    int OnCmdDispatch(xstring comdid) | 
 |  |  |    { | 
 |  |  |       if (comdid == L"xmMenu") OnMenu(0); | 
 |  |  |       //else if (comdid.find(L"menuid:", 0) >= 0) | 
 |  |  |       //   return OnMenu((HWND)comdid.mid(comdid.find(L":", 0) + 1, comdid.length()).toInt()); | 
 |  |  | #if 0 | 
 |  |  |       if (comdid ==L "xmAssignment") OnChangeLogin(); | 
 |  |  |  | 
 |  |  |       if (comdid ==L"xmAssignment") OnChangeLogin(); | 
 |  |  |       else if (comdid == L"xmAllCaption") OnAllCaption(); | 
 |  |  |       else if (comdid == L"xmMenu") OnMenu(L""); | 
 |  |  |       else if (comdid == L"xmMenu") OnMenu(0); | 
 |  |  |       else if (comdid == L"xmHelp") return OnHelp(); | 
 |  |  |       else if (comdid.find("menuid:", 0) >= 0) OnMenu(comdid.mid(comdid.find(":", 0) + 1, comdid.length())); | 
 |  |  |       else if (comdid.find("menuAgent:", 0) >= 0) OnMenuAgent(comdid.mid(comdid.find(":", 0) + 1, comdid.length())); | 
 |  |  |       else if (comdid.find("changesheet:", 0) >= 0) OnChangeSheet(comdid.mid(comdid.find(":", 0) + 1, comdid.length())); | 
 |  |  |       else if (comdid.find("openforoldid:", 0) >= 0) OnOpenForOld(comdid.mid(comdid.find(":", 0) + 1, comdid.length())); | 
 |  |  |       else if (comdid.find("open:", 0) >= 0) OnOpen(comdid.mid(comdid.find(":", 0) + 1, comdid.length())); | 
 |  |  |       else if (comdid == "xmRefreshTask") | 
 |  |  |       //else if (comdid.find(L"menuid:", 0) >= 0) OnMenu(comdid.mid(comdid.find(L":", 0) + 1, comdid.length())); | 
 |  |  |       else if (comdid.find(L"menuAgent:", 0) >= 0) OnMenuAgent(comdid.mid(comdid.find(L":", 0) + 1, comdid.length())); | 
 |  |  |       else if (comdid.find(L"changesheet:", 0) >= 0) OnChangeSheet(comdid.mid(comdid.find(L":", 0) + 1, comdid.length())); | 
 |  |  |       //else if (comdid.find(L"openforoldid:", 0) >= 0) OnOpenForOld(comdid.mid(comdid.find(L":", 0) + 1, comdid.length())); | 
 |  |  |       //else if (comdid.find(L"open:", 0) >= 0) OnOpen(comdid.mid(comdid.find(L":", 0) + 1, comdid.length())); | 
 |  |  |       else if (comdid == L"xmRefreshTask") | 
 |  |  |       { | 
 |  |  |          SendMessage(m_startwin, 0x401, comdid, 0); | 
 |  |  |          SendMessage(m_startwin, 0x401, (WPARAM)comdid.c_str(), 0); | 
 |  |  |          return 1; | 
 |  |  |       } | 
 |  |  | #endif | 
 |  |  |  | 
 |  |  |       return 0; | 
 |  |  |    } | 
 |  |  |     | 
 |  |  | 
 |  |  |    int OnAttachListon() | 
 |  |  |    { | 
 |  |  |       AttachEvent(L"WM_XCOMMAND",(FEvent)&vindexform::OnXCommand,this); | 
 |  |  |       //AttachEvent("mdilayer", "LYSN_SELECTEDSHEET",OnSheetChanged);	 | 
 |  |  |       ////AttachEvent("mdilayer", "LYSN_CLOSESHEET",OnCloseSheet);	 | 
 |  |  |       //AttachEvent(L"mdilayer", L"LYSN_SELECTEDSHEET", (FEvent)&vindexform::OnSheetChanged); | 
 |  |  |       ////AttachEvent(L"mdilayer", L"LYSN_CLOSESHEET",OnCloseSheet);	 | 
 |  |  |       return 1; | 
 |  |  |    } | 
 |  |  | 	 | 
 |  |  |    int OnSheetChanged(TEvent* evt, int p) | 
 |  |  |    { | 
 |  |  |       LYSNMHDR& nmtv = *(LYSNMHDR*)evt->notify.pnmh; | 
 |  |  |       int sheet = nmtv.nSheet; | 
 |  |  |       int s = mainsheet.GetSheetCount(); | 
 |  |  |       //trace(s); | 
 |  |  |       int cs = xcombobox::GetCount(cbx_menu.GetHWND()); | 
 |  |  |       int cursheet = m_cursheet; | 
 |  |  |  | 
 |  |  |       if (s > cs) { | 
 |  |  |          xcombobox::AddItem(cbx_menu.GetHWND(), L"自由窗口"); | 
 |  |  |          xcombobox::AddItem(cbx_tab.GetHWND(), xstring(cursheet)); | 
 |  |  |       } | 
 |  |  |       if (s < cs) { | 
 |  |  |          xcombobox::DeleteItem(cbx_menu.GetHWND(), cursheet); | 
 |  |  |          int i = 0; | 
 |  |  |          xstring value = xcombobox::GetLBText(cbx_tab.GetHWND(), cursheet); | 
 |  |  |          for (i = 0; i < cs; i++) | 
 |  |  |          { | 
 |  |  |             xstring tabId = xcombobox::GetLBText(cbx_tab.GetHWND(), i); | 
 |  |  |             if (tabId == xstring(cursheet)) | 
 |  |  |             { | 
 |  |  |                xcombobox::DeleteItem(cbx_tab.GetHWND(), i); | 
 |  |  |                xcombobox::InsertString(cbx_tab.GetHWND(), i, value); | 
 |  |  |             } | 
 |  |  |          } | 
 |  |  |          xcombobox::DeleteItem(cbx_tab.GetHWND(), cursheet); | 
 |  |  |          if (sheet != value.toInt()) | 
 |  |  |             mainsheet.SelectSheet(value.toInt()); | 
 |  |  |       } | 
 |  |  |  | 
 |  |  |       if (cursheet != mainsheet.GetSheetIndex()) | 
 |  |  |       { | 
 |  |  |          HWND hPicture = FindWindowEx(0, 0, L"XFrameWndClass", L"__ProductPicture"); | 
 |  |  |          if (hPicture) | 
 |  |  |          { | 
 |  |  |             int WM_CLOSE = 0x0010; | 
 |  |  |             PostMessage(hPicture, WM_CLOSE, 0, 0); | 
 |  |  |          } | 
 |  |  |       } | 
 |  |  |  | 
 |  |  |       m_cursheet = mainsheet.GetSheetIndex(); | 
 |  |  |       return 1; | 
 |  |  |    } | 
 |  |  |  | 
 |  |  |    int OnCloseSheet(TEvent* evt, int p) | 
 |  |  |    { | 
 |  |  |       LYSNMHDR& nmtv = *(LYSNMHDR*)evt->notify.pnmh; | 
 |  |  |       int sheet = nmtv.nSheet; | 
 |  |  |       //alert(L"xxxx"); | 
 |  |  |       return 1; | 
 |  |  |    } | 
 |  |  |  | 
 |  |  |    int SetUserID() | 
 |  |  |    { | 
 |  |  |       Hxsoft::XFrame::KXMLDOMDocument x; | 
 |  |  | 
 |  |  |       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 OnInitial() | 
 |  |  |    { | 
 |  |  |       xstring userno = xaserver::GetUserNo(); | 
 |  |  |       if (userno == L"admin" /*|| userno==L"00206" || userno==L"00206" || userno==L"00201" ||userno==L"00101" */) | 
 |  |  |       { | 
 |  |  |          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 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; | 
 |  |  |    } | 
 |  |  |  | 
 |  |  |  | 
 |  |  | }; |