Start() public method

Installs both mouse and keyboard hooks and starts rasing events
Any windows problem.
public Start ( ) : void
return void
Example #1
0
        // 建構子
        public MainWindow()
        {
            InitializeComponent();

            // 載入查詢過的單字
            load_words();

            //指定預設網站
            curTranslateUrl = Websties_Url[Websites_Names.Google];
            webBrowser1.Navigate(curTranslateUrl);

            // silent mode 關閉alert
            webBrowser1.Navigated += new NavigatedEventHandler(wbMain_Navigated);

            //hook
            actHook = new UserActivityHook();
            //actHook.OnMouseActivity += new System.Windows.Forms.MouseEventHandler(MouseMoved);
            //actHook.KeyPress += new System.Windows.Forms.KeyPressEventHandler(MyKeyPress);
            actHook.KeyDown += new System.Windows.Forms.KeyEventHandler(MyKeyDown);
            actHook.KeyUp += new System.Windows.Forms.KeyEventHandler(MyKeyUp);
            actHook.Start();

            // Application Idel (閒置時) 判斷視窗是否在最上層
            //DispatcherTimer timer = new DispatcherTimer
            //  (
            //  TimeSpan.FromTicks(400),
            //  DispatcherPriority.ApplicationIdle,// Or DispatcherPriority.SystemIdle
            //  (s, e) => { isFormTopCheck(); },
            //  System.Windows.Application.Current.Dispatcher
            //  );
            //timer.Start();

            textBox1.Focus();
            curCopyStr = System.Windows.Forms.Clipboard.GetText();
        }
        private void FirstTimeRun_Load(object sender, EventArgs e)
        {
            actHook = new UserActivityHook(true, true); //Create an instance with global hooks
            actHook.OnMouseActivity += new MouseEventHandler(MouseActivity); //Currently there is no mouse activity
            actHook.Start();

            label1.Text = "Welcome to =] FaceMouse, this is the quick-start guide to learn using this program. Click anywhere to start the tutorial.";
            step = 0;
        }
Example #3
0
        private void Main_Load(object sender, EventArgs e)
        {
            this.Hide();

            currentStage = FourStepStage.FIRST_TIME_RUN;
            primaryScreen = Screen.PrimaryScreen;
            zoomLevel = 4.0f;

            actHook = new UserActivityHook(true, true); //Create an instance with global hooks
            actHook.OnMouseActivity += new MouseEventHandler(MouseActivity); //Currently there is no mouse activity
            actHook.Start();

            //this.DoubleBuffered = true;
            //this.SetStyle(ControlStyles.DoubleBuffer | ControlStyles.UserPaint | ControlStyles.AllPaintingInWmPaint, true);
            //this.UpdateStyles();

            firstTimeRunDialog = new FirstTimeRun();
            firstTimeRunDialog.Show();

            rangeWindow = new RangeWindow();
            rangeWindow.Size = new Size((int)(primaryScreen.Bounds.Width / zoomLevel), (int)(primaryScreen.Bounds.Height / zoomLevel));
            //rangeWindow.Show();

            //cursorImage = Resources.cursor;

            //Uncomment to make clickable trough
            //int initialStyle = GetWindowLong(this.Handle, -20);
            //SetWindowLong(this.Handle, -20, initialStyle | 0x80000 | 0x20);

            //TakeScreenshot(); //Uncomment to take screeshot when program starts
        }
Example #4
0
        private void Form1_Load(object sender, EventArgs e)
        {
            player = new SoundPlayer(Properties.Resources.click);

            int right = System.Windows.Forms.Screen.PrimaryScreen.Bounds.Size.Width;

            //Load the smooth linked list and load the first values
            ollXValues = new LinkedList<float>();
            ollYValues = new LinkedList<float>();
            for (int iA = 0; iA < SMOOTH; iA++)
            {
                ollXValues.AddFirst(0);
                ollYValues.AddFirst(0);
            }

            ////The following code causes random errors when used along with the actHook, how do we solve this!? Tried several approaches...
            ////Create overlay window
            //FirstTimeRun asdf = new FirstTimeRun();
            //asdf.ShowDialog();
            //asdf = null;

            //Create the keyboard hook
            actHook = new UserActivityHook(false, true); //Create an instance with global hooks
            actHook.KeyDown += new KeyEventHandler(MyKeyDown); //Not needed
            actHook.Start();
        }
        private void JangoDesktopLoad(object sender, EventArgs e)
        {
            if (!Settings.Default.StartMinimized)
            {
                ToggleJangoDesktop();
            }
            if (Settings.Default.AutoLogin)
            {
                //AutoLogin is turned on
                string decryptedUsername = AESEncryption.Decrypt(Settings.Default.JangoUsername, Environment.MachineName + Environment.ProcessorCount, Environment.UserName, "SHA1", Environment.ProcessorCount, "16CHARSLONG12345", 256);
                string decryptedPassword = AESEncryption.Decrypt(Settings.Default.JangoPassword, Environment.MachineName + Environment.ProcessorCount, Environment.UserName, "SHA1", Environment.ProcessorCount, "16CHARSLONG12345", 256);
                JangoBrowser.Navigate("http://www.jango.com/splogin?user[email]=" + decryptedUsername + "&user[password]=" + decryptedPassword);
            }
            else
            {
                JangoBrowser.Navigate("http://www.jango.com");
            }

            //Start Keyboard Hook
            try
            {
                _actHook = new UserActivityHook();
                _actHook.KeyDown += new KeyEventHandler(MyKeyDown);
                _actHook.Start();
            }
            catch (Exception)
            {
                MessageBox.Show("Error setting up media keys. They will not work. Try restarting Jango Desktop");
            }

            _starting = false;
        }