Beispiel #1
0
        /// <summary>
        /// Capture loop
        /// </summary>

        private void Capt()
        {
            do
            {
                Thread.Sleep(1000);
                if (Variables.Proc != null)
                {
                    if (Variables.Proc.HasExited)
                    {
                        Variables.Proc = null;
                        Docked         = false;
                        continue;
                    }
                    if (Variables.emulator.EmulatorName() == "Nox")
                    {
                        var hide = DllImport.GetAllChildrenWindowHandles(IntPtr.Zero, "Qt5QWindowToolSaveBits", "Form", 2);
                        foreach (var h in hide)
                        {
                            DllImport.ShowWindow(h, 0);
                        }
                    }
                    try
                    {
                        var       handle = Variables.Proc.MainWindowHandle;
                        var       parent = DllImport.GetParent(handle);
                        Rectangle rect   = new Rectangle();
                        DllImport.GetWindowRect(handle, ref rect);
                        if (!Docked)
                        {
                            if (!ScriptRun.Run)
                            {
                                return;
                            }
                            PrivateVariable.EmuDefaultLocation = rect;
                            panel3.Invoke((MethodInvoker) delegate
                            {
                                DllImport.SetParent(Variables.Proc.MainWindowHandle, panel3.Handle);
                            });
                            tp.Invoke((MethodInvoker) delegate { tp.BringToFront(); });
                            Docked = true;
                        }
                        if (rect.X != -1 || rect.Y != -30)
                        {
                            DllImport.MoveWindow(handle, -1, -30, 1318, 752, false);
                        }
                    }
                    catch
                    {
                    }
                }
                else
                {
                    Docked = false;
                }
            } while (ScriptRun.Run);
        }
Beispiel #2
0
        /// <summary>
        /// Capture loop
        /// </summary>

        private void Capt()
        {
            bool Docked = false;

            do
            {
                Thread.Sleep(2000);
                if (Variables.Proc != null)
                {
                    if (Variables.Proc.HasExited)
                    {
                        Variables.Proc = null;
                        Docked         = false;
                        continue;
                    }
                    try
                    {
                        var       handle = Variables.Proc.MainWindowHandle;
                        Rectangle rect   = new Rectangle();
                        DllImport.GetWindowRect(handle, ref rect);
                        if (!Docked)
                        {
                            if (!ScriptRun.Run)
                            {
                                return;
                            }
                            PrivateVariable.Instance.EmuDefaultLocation = rect;
                            panel3.Invoke((MethodInvoker) delegate
                            {
                                DllImport.SetParent(Variables.Proc.MainWindowHandle, panel3.Handle);
                            });
                            tp.Invoke((MethodInvoker) delegate { tp.BringToFront(); });
                            panel3.Invoke((MethodInvoker) delegate
                            {
                                DllImport.SetParent(Variables.Proc.MainWindowHandle, panel3.Handle);
                            });
                            Docked = true;
                        }
                        if (rect.X != -1 || rect.Y != -30)
                        {
                            DllImport.MoveWindow(handle, -1, -30, 1318, 752, false);
                        }
                    }
                    catch
                    {
                    }
                }
                else
                {
                    Docked = false;
                }
            } while (ScriptRun.Run);
        }