/// <summary>
        /// フレンドリー操作ウィンドウ開始。
        /// </summary>
        /// <param name="controlInfo">コントロール情報。</param>
        /// <returns>FriendlyConnectorWindowInAppのハンドル。</returns>
        IntPtr StartFriendlyConnectorWindowInApp(SystemControlInfo controlInfo)
        {
            IntPtr targetThreadWindowHandle     = (IntPtr)controlInfo.Data;
            FriendlyConnectorWindowInApp window = null;
            IntPtr executeWindowHandle          = IntPtr.Zero;

            if (!TargetWindowExecutor.Execute(targetThreadWindowHandle, delegate
            {
                window = new FriendlyConnectorWindowInApp(_handleAndWindow, _dotNetFriendlyControl);
                executeWindowHandle = window.Handle;
            }))
            {
                return(IntPtr.Zero);
            }

            //登録
            _handleAndWindow.Add(executeWindowHandle, window);
            return(executeWindowHandle);
        }
        /// <summary>
        /// データ受信時の処理。
        /// </summary>
        /// <param name="communicationNo">通信番号。</param>
        /// <param name="recieveData">受信データ。</param>
        /// <param name="senderWindow">送信元ウィンドウ。</param>
        protected override void OnRecieveData(int communicationNo, object recieveData, IntPtr senderWindow)
        {
            SystemControlInfo controlInfo = (SystemControlInfo)recieveData;
            object            ret         = null;

            switch (controlInfo.SystemControlType)
            {
            case SystemControlType.StartFriendlyConnectorWindowInApp:
                ret = StartFriendlyConnectorWindowInApp(controlInfo);
                break;

            case SystemControlType.EndFriendlyConnectorWindowInApp:
                EndFriendlyConnectorWindowInApp(controlInfo);
                break;

            case SystemControlType.EndSystem:
                EndSystem();
                break;
            }
            SendReturnData(communicationNo, senderWindow, ret);
        }
        void EndFriendlyConnectorWindowInApp(SystemControlInfo controlInfo)
        {
            IntPtr handle = (IntPtr)controlInfo.Data;
            FriendlyConnectorWindowInApp invokeWindow = _handleAndWindow.FromHandle(handle);

            _handleAndWindow.Remove(handle);

            //スレッドが異なるので、Invokeによって終了処理を実施する。
            if (invokeWindow != null)
            {
                try
                {
                    invokeWindow.Invoke((MethodInvoker) delegate
                    {
                        try
                        {
                            invokeWindow.RequestDispose();
                        }
                        catch { }
                    });
                }
                catch { }
            }
        }