예제 #1
0
        public void SetApplicationClose(int wndId)
        {
            ClientWndCmd wndCommand = new ClientWndCmd();

            wndCommand.CommandType = ClientWndCmd.CommandId.EClose;
            wndCommand.Id          = wndId;

            connectionMgr.BroadcastMessage(
                (int)CommandConst.MainCommandClient.ControlInfo,
                (int)CommandConst.SubCommandClient.WindowsAttributes,
                wndCommand);
        }
예제 #2
0
        public override void ExecuteCommand(string userId, string command)
        {
            ClientWndCmd data = deserialize.Deserialize <ClientWndCmd>(command);

            if (data == null)
            {
                return;
            }

            switch (data.CommandType)
            {
            case ClientWndCmd.CommandId.EMinimize:
                NativeMethods.ShowWindow(new IntPtr(data.Id), Constant.SW_SHOWMINIMIZED);
                break;

            case ClientWndCmd.CommandId.EMaximize:
                NativeMethods.ShowWindow(new IntPtr(data.Id), Constant.SW_SHOWMAXIMIZED);
                NativeMethods.SetForegroundWindow(new IntPtr(data.Id));
                break;

            case ClientWndCmd.CommandId.ERelocation:
                NativeMethods.SetWindowPos(new IntPtr(data.Id), Constant.HWND_TOP, data.PositionX, data.PositionY, 0, 0, (Int32)(Constant.SWP_NOSIZE | Constant.SWP_ASYNCWINDOWPOS));
                break;

            case ClientWndCmd.CommandId.EResize:
                NativeMethods.SetWindowPos(new IntPtr(data.Id), Constant.HWND_TOP, 0, 0, data.Width, data.Height, (Int32)(Constant.SWP_NOMOVE | Constant.SWP_ASYNCWINDOWPOS));
                break;

            case ClientWndCmd.CommandId.ERestore:
                NativeMethods.ShowWindow(new IntPtr(data.Id), Constant.SW_SHOWNORMAL);
                NativeMethods.SendMessage(new IntPtr(data.Id), Constant.WM_USER + 1002, IntPtr.Zero, IntPtr.Zero);          // cater Ultra VNC custom restore message - from spy++
                break;

            case ClientWndCmd.CommandId.EClose:
                NativeMethods.PostMessage(new IntPtr(data.Id), Constant.WM_CLOSE, IntPtr.Zero, IntPtr.Zero);

                // remove from user's trigger list
                int userDBid = ConnectedClientHelper.GetInstance().GetClientInfo(userId).DbUserId;
                Server.LaunchedWndHelper.GetInstance().RemoveLaunchedApp(userDBid, data.Id);
                Server.LaunchedSourcesHelper.GetInstance().RemoveLaunchedApp(userDBid, data.Id);
                Server.LaunchedVncHelper.GetInstance().RemoveLaunchedApp(userDBid, data.Id);

                break;

            case ClientWndCmd.CommandId.ESetForeground:
                NativeMethods.SetWindowPos(new IntPtr(data.Id), Constant.HWND_TOPMOST, 0, 0, 0, 0, (Int32)(Constant.SWP_NOMOVE | Constant.SWP_NOSIZE | Constant.SWP_SHOWWINDOW));
                NativeMethods.SetWindowPos(new IntPtr(data.Id), Constant.HWND_NOTOPMOST, 0, 0, 0, 0, (Int32)(Constant.SWP_NOMOVE | Constant.SWP_NOSIZE | Constant.SWP_SHOWWINDOW));
                break;

            default:
                break;
            }
        }
예제 #3
0
        public void SetApplicationPos(int wndId, int xPos, int yPos)
        {
            ClientWndCmd wndCommand = new ClientWndCmd();

            wndCommand.CommandType = ClientWndCmd.CommandId.ERelocation;
            wndCommand.Id          = wndId;
            wndCommand.PositionX   = xPos;
            wndCommand.PositionY   = yPos;

            connectionMgr.BroadcastMessage(
                (int)CommandConst.MainCommandClient.ControlInfo,
                (int)CommandConst.SubCommandClient.WindowsAttributes,
                wndCommand);
        }
예제 #4
0
        public void SetApplicationSize(int wndId, Size newSize)
        {
            ClientWndCmd wndCommand = new ClientWndCmd();

            wndCommand.CommandType = ClientWndCmd.CommandId.EResize;
            wndCommand.Id          = wndId;
            wndCommand.Width       = newSize.Width;
            wndCommand.Height      = newSize.Height;

            connectionMgr.BroadcastMessage(
                (int)CommandConst.MainCommandClient.ControlInfo,
                (int)CommandConst.SubCommandClient.WindowsAttributes,
                wndCommand);
        }
예제 #5
0
        public override void ExecuteCommand(string userId, string command)
        {
            ClientWndCmd data = deserialize.Deserialize <ClientWndCmd>(command);

            if (data == null)
            {
                return;
            }

            switch (data.CommandType)
            {
            case ClientWndCmd.CommandId.EMinimize:
                NativeMethods.ShowWindow(new IntPtr(data.Id), Constant.SW_SHOWMINIMIZED);
                break;

            case ClientWndCmd.CommandId.EMaximize:
                NativeMethods.ShowWindow(new IntPtr(data.Id), Constant.SW_SHOWMAXIMIZED);
                NativeMethods.SetForegroundWindow(new IntPtr(data.Id));
                break;

            case ClientWndCmd.CommandId.ERelocation:
                NativeMethods.SetWindowPos(new IntPtr(data.Id), Constant.HWND_TOP, data.PositionX, data.PositionY, 0, 0, (Int32)(Constant.SWP_NOSIZE));
                break;

            case ClientWndCmd.CommandId.EResize:
                NativeMethods.SetWindowPos(new IntPtr(data.Id), Constant.HWND_TOP, 0, 0, data.Width, data.Height, (Int32)Constant.SWP_NOMOVE);
                break;

            case ClientWndCmd.CommandId.ERestore:
                NativeMethods.ShowWindow(new IntPtr(data.Id), Constant.SW_SHOWNORMAL);
                break;

            case ClientWndCmd.CommandId.EClose:
                NativeMethods.SendMessage(new IntPtr(data.Id), Constant.WM_CLOSE, IntPtr.Zero, IntPtr.Zero);
                break;

            case ClientWndCmd.CommandId.ESetForeground:
                NativeMethods.SetForegroundWindow(new IntPtr(data.Id));
                break;

            default:
                break;
            }
        }