Ejemplo n.º 1
0
        protected override void OnLoad(EventArgs e)
        {
            base.OnLoad(e);

            if (!_isSlave)
            {
                var psi = new ProcessStartInfo(_anotherExePath)
                {
                    Arguments = string.Format("SLAVEOF {0:X}", Handle.ToInt64()),
                    Verb      = "runas"
                };
                _x86Process = new Process {
                    StartInfo = psi
                };
                _x86Process.Start();

                Utils.SetWindowTopMost(Handle, true);
                Utils.CurrentWindowsList = Utils.GetAllWindows();
                foreach (var hwnd in Utils.CurrentWindowsList)
                {
                    AddToList("Exist", hwnd);
                    if (SystemMenu.InsertSystmMenu(hwnd))
                    {
                        SystemMenu.InitializeSystemMenu(hwnd);
                    }
                }
            }

            Text += IntPtr.Size == 4 ? " (x86)" : " (x64)";

            HookMessages.RegisterMessages();
            HookMethods.StartHook(Handle);
        }
Ejemplo n.º 2
0
        protected override void OnFormClosing(FormClosingEventArgs e)
        {
            HookMethods.StopHook();
            HookMessages.UnregisterMessages();

            if (!_isSlave)
            {
                foreach (var hwnd in Utils.CurrentWindowsList)
                {
                    SystemMenu.RemoveSystemMenu(hwnd);
                }
                if (_x86Process != null && !_x86Process.HasExited)
                {
                    Utils.ExitProcess(_x86Process);
                }
            }

            base.OnFormClosing(e);
        }