예제 #1
0
파일: Watcher.cs 프로젝트: johnsewell/APE
        public Watcher()
        {
            //InitializeComponent();
            this.FormBorderStyle = System.Windows.Forms.FormBorderStyle.None;
            NM.MoveWindow(this.Handle, 0, 0, 0, 0, false);

            string[] args = Environment.GetCommandLineArgs();

            if (args.Length == 3)
            {
                int  ParentPid        = int.Parse(args[1]);
                uint DoubleClickTimer = uint.Parse(args[2]);

                //TimerResolution.SetTimerResolution(TimerResolution.GetMaximumTimerResolution());
                Process.GetProcessById(ParentPid).WaitForExit();
                //TimerResolution.UnsetTimerResolution();

                uint CurrentDoubleClickTimer = (uint)SystemInformation.DoubleClickTime;

                if (CurrentDoubleClickTimer == 1)   //APE probably messed with it so
                {
                    if (DoubleClickTimer == 1)      //Really messed up so reset it a reasonable 340
                    {
                        DoubleClickTimer = 340;
                    }
                    NM.SetDoubleClickTime(DoubleClickTimer);   //Put it back to what it was when APE started
                }

                base.AppbarNew(AppBarEdges.Top);    //Add and remove an appbar to make sure they are reset if APE is killed off
                base.AppbarRemove();

                Environment.Exit(0);
            }
            else
            {
                Environment.Exit(-1);
            }
        }
예제 #2
0
        public Watcher()
        {
            this.FormBorderStyle = FormBorderStyle.None;
            NM.MoveWindow(this.Handle, 0, 0, 0, 0, false);
            this.Load += new EventHandler(this.Watcher_Load);

            string[] args = Environment.GetCommandLineArgs();

            if (args.Length == 3)
            {
                int  parentPid        = int.Parse(args[1]);
                uint doubleClickTimer = uint.Parse(args[2]);

                Process.GetProcessById(parentPid).WaitForExit();

                uint CurrentDoubleClickTimer = (uint)SystemInformation.DoubleClickTime;

                if (CurrentDoubleClickTimer <= NM.IntraClickDelay)   //APE probably messed with it so
                {
                    if (doubleClickTimer <= NM.IntraClickDelay)      //Really messed up so reset it to a reasonable 340
                    {
                        doubleClickTimer = 340;
                    }
                    NM.SetDoubleClickTime(doubleClickTimer);   //Put it back to what it was when APE started
                }

                base.AppbarNew(AppBarEdges.Top);    //Add and remove an appbar to make sure maximised windows are restored properly
                base.AppbarRemove();

                Program.ExitCode = 0;
            }
            else
            {
                Program.ExitCode = 1;
            }
        }