Пример #1
0
        public frmPickArea(frmMain mainFrm)
        {
            main = mainFrm;

            InitializeComponent();

            keyboardHookManager = new KeyboardHookListener(new GlobalHooker());
            keyboardHookManager.Enabled = true;
            keyboardHookManager.KeyDown += HookManager_KeyDown;

            Rectangle rect = Main.screenshotManager.GetCompleteScreen();

            screenBitmap = Main.screenshotManager.MakeBitmapFromScreen();

            this.Location = rect.Location;
            this.Size = rect.Size;
        }
Пример #2
0
        private static bool LaunchInt(string filename)
        {
            string mutexId = "Global\\foxScreenMutex";

            mutex = new Mutex(false, mutexId);

            MutexAccessRule allowEveryoneRule = new MutexAccessRule(new SecurityIdentifier(WellKnownSidType.WorldSid, null), MutexRights.FullControl, AccessControlType.Allow);
            MutexSecurity securitySettings = new MutexSecurity();
            securitySettings.AddAccessRule(allowEveryoneRule);
            mutex.SetAccessControl(securitySettings);

            bool hasHandle = false;
            try
            {
                try
                {
                    hasHandle = mutex.WaitOne(100, false);
                    if (hasHandle == false)
                    {
                        mutex = null;
                        return false;
                    }
                }
                catch (AbandonedMutexException)
                {
                    hasHandle = true;
                }

                uploadOrganizer = new UploadOrganizer();
                screenshotManager = new ScreenshotManager(uploadOrganizer);

                if (filename != null)
                {
                    if (LoadCredentials())
                    {
                        uploadOrganizer.AddFileUpload(filename);
                    }
                }

                mainFrm = new frmMain();
                Application.Run(mainFrm);
            }
            catch(Exception e)
            {
                MessageBox.Show(e.ToString());
                if (!hasHandle)
                {
                    mutex = null;
                }
                Stop();
            }

            return true;
        }