From de9349d5502e956b09cebccb2c9dbb66f62a42f0 Mon Sep 17 00:00:00 2001 From: LiFan <2308045698@qq.com> Date: 星期一, 15 七月 2024 17:34:05 +0800 Subject: [PATCH] update --- jrj/project/vindexform.cpp | 213 +++++++++++++++++++++++++++++++++------------------- 1 files changed, 134 insertions(+), 79 deletions(-) diff --git a/jrj/project/vindexform.cpp b/jrj/project/vindexform.cpp index a229ce7..8d41e92 100644 --- a/jrj/project/vindexform.cpp +++ b/jrj/project/vindexform.cpp @@ -9,6 +9,8 @@ #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 @@ -28,13 +30,13 @@ xcombobox panelNo; //椤电鏁扮粍 xcombobox panelName; //椤电椤哄簭鏁扮粍 - int m_npHwnd; //鑿滃崟鏍戠獥鍙e彞鏌� - int m_nHwnd; //鑿滃崟鏍戠獥鍙e彞鏌� + HWND m_npHwnd; //鑿滃崟鏍戠獥鍙e彞鏌� + HWND m_nHwnd; //鑿滃崟鏍戠獥鍙e彞鏌� int m_cursheet; //褰撳墠椤电 int menuShow; - int m_npHwnd2; //openwindow - int m_startwin; + HWND m_npHwnd2; //openwindow + HWND m_startwin; public: vindexform(void* implPtr,HWND hWnd):xwin(implPtr,hWnd){} @@ -97,7 +99,58 @@ alert(L"clicked"); return 1; } + int OnMenu(HWND 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"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); + 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 = hMenu; + } + + 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 OnMenu1(xstring hMenu) { if (!hMenu) { @@ -127,7 +180,7 @@ } else { - m_hMenu = hMenu; + m_hMenu = (HWND)hMenu.toInt64(); } xrect xr; @@ -148,17 +201,17 @@ } int OnMenuAgent(xstring f) { - int LayerFlow_None = 0x00000001; - int LayerFlow_UnLayer = 0x00000100; - int LayerFlow_NS = 0x00000004; - int LayerFlow_Control = 0x00000010; + //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; - int HWND_TOPMOST = -1; - int HWND_NOTOPMOST = -2; + HWND HWND_TOPMOST = (HWND) - 1; + HWND HWND_NOTOPMOST = (HWND) - 2; int SWP_NOSIZE = 0x0001; int SWP_NOMOVE = 0x0002; int SWP_SHOWWINDOW = 0x0040; @@ -174,12 +227,12 @@ style = style - WS_POPUP; style = style + WS_CHILD; - xwin::SetWindowLong(m_nHwnd, GWL_STYLE, style); + SetWindowLong(m_nHwnd, GWL_STYLE, style); - m_npHwnd = xwin::GetParent(m_nHwnd); + m_npHwnd = GetParent(m_nHwnd); xcontrol xc = GetControl(L"menuAgent"); - xwin::SetParent(m_nHwnd, xc.GetId()); - xwin::ShowWindow(m_nHwnd, SW_MAXIMIZE); + SetParent(m_nHwnd, xc.GetHWND()); + ShowWindow(m_nHwnd, SW_MAXIMIZE); ///AttachEvent(L"WM_SIZE",OnMenuSizeChanged); //AttachEvent(L"WM_PAINT",OnMenuSizeChanged); @@ -192,14 +245,14 @@ style = style + WS_POPUP; style = style - WS_CHILD; - xwin::SetWindowLong(m_nHwnd, GWL_STYLE, style); - xwin::SetParent(m_nHwnd, m_npHwnd); - OnMenu(L""); + SetWindowLong(m_nHwnd, GWL_STYLE, style); + SetParent(m_nHwnd, m_npHwnd); + OnMenu(NULL); } menuShow = -1 - isshow; - xcombobox::SetCurSel(memuId.GetId(), menuShow); + xcombobox::SetCurSel(memuId.GetHWND(), menuShow); if (f != L"") - setHomeConfig(L"menuposition", menuShow.toString()); + setHomeConfig(L"menuposition", xstring(menuShow)); return 1; } @@ -212,14 +265,15 @@ xstring f = getHomeConfig(L"menuposition"); if (f == L"0") { - OnMenu(L""); + OnMenu(NULL); OnMenuAgent(L""); } xaserverarg arg; - int h = GetHWND(); - arg.AddArg(L"hwnd", xstring(h)); + HWND h = GetHWND(); + //arg.AddArg(L"hwnd", xstring(h)); + arg.SetParam(L"hwnd", h); OpenWindow(L"dev:xpage[vindexforold.vx]", arg); @@ -228,17 +282,17 @@ int ReSetInfo() { - - xcombobox::ResetContent(memuId.GetId()); - xcombobox::ResetContent(tabNo.GetId()); - xcombobox::ResetContent(panelNo.GetId()); - xcombobox::ResetContent(panelName.GetId()); + + memuId.ResetContent(); + tabNo.ResetContent(); + panelNo.ResetContent(); + panelName.ResetContent(); int hItem = mainsheet.GetSheetCount(); while (hItem > 1) { //mainsheet.DeleteSheet(hItem - 1); - SendMessage(GetHWND(), 0x401, L"xmSheetClose", 0); + SendMessage(GetHWND(), 0x401, (WPARAM)L"xmSheetClose", 0); hItem = mainsheet.GetSheetCount(); } @@ -264,10 +318,10 @@ if (m_Assignment == L"") alert(L"鑾峰彇鐢ㄦ埛鏁版嵁澶辫触锛岃閲嶆柊鐧诲綍!"); else - xaserver::SetUserId(m_Assignment); + xaserver::SetUID((LPWSTR)m_Assignment); - xcombobox::AddItem(memuId.GetId(), L"寮�濮�"); - xcombobox::AddItem(tabNo.GetId(), L"-1"); + xcombobox::AddItem(memuId.GetHWND(), L"寮�濮�"); + xcombobox::AddItem(tabNo.GetHWND(), L"-1"); //OpenWindow(L"dev:xpage[vstart.vx]"); xcontrol xc = GetControl(L"statusbar0"); xc.SetText(L"姝e湪鍒濆鍖栫郴缁燂紝璇风◢鍊�...."); @@ -303,7 +357,7 @@ xstring sInfo = m_Assignment; if (s > 0) { - int m = xwin::CreatePopupMenu(); + HMENU m = CreatePopupMenu(); int MF_STRING = 0x00000000; int MF_DISABLED = 0x00000002; int TPM_RIGHTBUTTON = 0x0002; @@ -315,14 +369,14 @@ xstring id = xitem.selectSingleNode(L"AssignmentID").text(); xstring name = xitem.selectSingleNode(L"PositionName").text(); if (sInfo == id) - xwin::AppendMenu(m, MF_STRING | MF_CHECKED, i + 1, name); + AppendMenu(m, MF_STRING | MF_CHECKED, i + 1, name); else - xwin::AppendMenu(m, MF_STRING, i + 1, name); + AppendMenu(m, MF_STRING, i + 1, name); } - xrect xr; + RECT xr; xpoint pt; - xwin::GetCursorPos(pt); - int res = xwin::TrackPopupMenu(m, TPM_RIGHTBUTTON | TPM_RETURNCMD, pt.x, pt.y, 0, GetHWND(), xr); + 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(); @@ -339,7 +393,7 @@ int OnAllCaption() { - int m = xwin::CreatePopupMenu(); + HMENU m = CreatePopupMenu(); int MF_STRING = 0x00000000; int MF_DISABLED = 0x00000002; int TPM_RIGHTBUTTON = 0x0002; @@ -354,14 +408,14 @@ //string str = xcombobox::GetLBText(memuId.GetId(), i); xstring str = mainsheet.GetSheetText(i); if (i == k) - xwin::AppendMenu(m, MF_STRING | MF_CHECKED, i + 1, str); + AppendMenu(m, MF_STRING | MF_CHECKED, i + 1, str); else - xwin::AppendMenu(m, MF_STRING, i + 1, str); + AppendMenu(m, MF_STRING, i + 1, str); } - xrect xr; + RECT xr; xpoint pt; - xwin::GetCursorPos(pt); - int res = xwin::TrackPopupMenu(m, TPM_RIGHTBUTTON | TPM_RETURNCMD, pt.x, pt.y, 0, this.GetHWND(), xr); + 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; @@ -392,11 +446,13 @@ { int SW_MAXIMIZE = 3; xcontrol xc = GetControl(L"menuAgent"); - xwin::SetParent(m_nHwnd, xc.GetId()); - xwin::ShowWindow(m_nHwnd, SW_MAXIMIZE); + 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); @@ -407,22 +463,21 @@ return 1; }*/ - int p = pa.toInt(); 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"]", p); + OpenWindow(L"dev:xpage[" + vx + L"]", arg); else openUrl(vx, p); return 1; } - OpenWindow(L"dev:xpage[vindexforold.vx]", p); + //OpenWindow(L"dev:xpage[vindexforold.vx]", p); return 1; } + int OnOpenForOld(xstring pa) { m_npHwnd2 = pa.toInt(); @@ -431,18 +486,18 @@ int WS_POPUP = 0x80000000; int WS_CHILD = 0x40000000; int SW_MAXIMIZE = 3; - int style = xwin::GetWindowLong(m_npHwnd2, GWL_STYLE); + int style = GetWindowLong(m_npHwnd2, GWL_STYLE); style = style - WS_POPUP; style = style + WS_CHILD; - xwin::SetWindowLong(m_npHwnd2, GWL_STYLE, style); + SetWindowLong(m_npHwnd2, GWL_STYLE, style); xcontrol xc = GetControl(L"openforold"); - xwin::SetParent(m_npHwnd2, xc.GetId()); + SetParent(m_npHwnd2, xc.GetHWND()); - xwin::ShowWindow(m_npHwnd2, SW_MAXIMIZE); + ShowWindow(m_npHwnd2, SW_MAXIMIZE); return 1; } - +#endif int OnHelp() { OpenWindow(L"dev:xpage[trade.help3.vx]"); @@ -454,18 +509,18 @@ //else if (comdid.find(L"menuid:", 0) >= 0) // return OnMenu((HWND)comdid.mid(comdid.find(L":", 0) + 1, comdid.length()).toInt()); - 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(L"menuid:", 0) >= 0) OnMenu(comdid.mid(comdid.find(L":", 0) + 1, comdid.length())); + //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.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; } @@ -480,48 +535,48 @@ int OnAttachListon() { AttachEvent(L"WM_XCOMMAND",(FEvent)&vindexform::OnXCommand,this); - //AttachEvent(L"mdilayer", L"LYSN_SELECTEDSHEET",OnSheetChanged); + //AttachEvent(L"mdilayer", L"LYSN_SELECTEDSHEET", (FEvent)&vindexform::OnSheetChanged); ////AttachEvent(L"mdilayer", L"LYSN_CLOSESHEET",OnCloseSheet); return 1; } int OnSheetChanged(TEvent* evt, int p) { - ref LYSNMHDR nmtv = trust(evt.pnmh as ref LYSNMHDR); + LYSNMHDR& nmtv = *(LYSNMHDR*)evt->notify.pnmh; int sheet = nmtv.nSheet; int s = mainsheet.GetSheetCount(); //trace(s); - int cs = xcombobox::GetCount(memuId.GetId()); + int cs = xcombobox::GetCount(memuId.GetHWND()); int cursheet = m_cursheet; if (s > cs) { - xcombobox::AddItem(memuId.GetId(), L"鑷敱绐楀彛"); - xcombobox::AddItem(tabNo.GetId(), cursheet.toString()); + xcombobox::AddItem(memuId.GetHWND(), L"鑷敱绐楀彛"); + xcombobox::AddItem(tabNo.GetHWND(), xstring(cursheet)); } if (s < cs) { - xcombobox::DeleteItem(memuId.GetId(), cursheet); + xcombobox::DeleteItem(memuId.GetHWND(), cursheet); int i = 0; - xstring value = xcombobox::GetLBText(tabNo.GetId(), cursheet); + xstring value = xcombobox::GetLBText(tabNo.GetHWND(), cursheet); for (i = 0; i < cs; i++) { - xstring tabId = xcombobox::GetLBText(tabNo.GetId(), i); - if (tabId == cursheet.toString()) + xstring tabId = xcombobox::GetLBText(tabNo.GetHWND(), i); + if (tabId == xstring(cursheet)) { - xcombobox::DeleteItem(tabNo.GetId(), i); - xcombobox::InsertString(tabNo.GetId(), i, value); + xcombobox::DeleteItem(tabNo.GetHWND(), i); + xcombobox::InsertString(tabNo.GetHWND(), i, value); } } - xcombobox::DeleteItem(tabNo.GetId(), cursheet); + xcombobox::DeleteItem(tabNo.GetHWND(), cursheet); if (sheet != value.toInt()) mainsheet.SelectSheet(value.toInt()); } if (cursheet != mainsheet.GetSheetIndex()) { - int hPicture = xwin::FindWindowEx(0, 0, L"XFrameWndClass", L"__ProductPicture"); - if (hPicture > 0) + HWND hPicture = FindWindowEx(0, 0, L"XFrameWndClass", L"__ProductPicture"); + if (hPicture) { int WM_CLOSE = 0x0010; - xwin::PostMessage(hPicture, WM_CLOSE, 0, 0); + PostMessage(hPicture, WM_CLOSE, 0, 0); } } @@ -531,7 +586,7 @@ int OnCloseSheet(TEvent* evt, int p) { - ref LYSNMHDR nmtv = trust(evt.pnmh as ref LYSNMHDR); + LYSNMHDR& nmtv = *(LYSNMHDR*)evt->notify.pnmh; int sheet = nmtv.nSheet; //alert(L"xxxx"); return 1; @@ -569,8 +624,8 @@ 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; + int LayerFlow_WE_ = 0x00000002; + int LayerFlow_Control_ = 0x00000010; anode.SetLayerFlow(LayerFlow_WE | LayerFlow_Control); } -- Gitblit v1.9.3