Exemple #1
0
        static void Main()
        {
            Application.EnableVisualStyles();
            Application.SetCompatibleTextRenderingDefault(false);
            Application.ThreadException += new ThreadExceptionEventHandler(Application_ThreadException);

            _icon = new NotifyIcon();
            //load the icon
            using (Stream s = System.Reflection.Assembly.GetExecutingAssembly().GetManifestResourceStream("AnAppADay.MissileCommand.WinApp.App.ico"))
            {
                _icon.Icon = new Icon(s);
            }

            MenuItem[] items = new MenuItem[2];
            items[1]          = new MenuItem("Exit");
            items[1].Click   += new EventHandler(Exit_Click);
            items[0]          = new MenuItem("About");
            items[0].Click   += new EventHandler(About_Click);
            _icon.ContextMenu = new ContextMenu(items);
            _icon.Visible     = true;

            _dumbForm          = new MissileForm();
            _dumbForm.Location = new Point(-1000, -1000);
            _dumbForm.Show();
            _dumbForm.Hide();

            _mouseHook = new MouseHookManager();
            _mouseHook.OnMouseActivity += new MouseEventHandler(_mouseHook_OnMouseActivity);

            Application.Run();
        }
        public static MouseHookManager HookMouse(IMouseHookUser user, bool enabled)
        {
            MouseHookManager result = new MouseHookManager(IntPtr.Zero, user);

            result.HookMessages = enabled;
            return(result);
        }
        public static MouseHookManager HookMouse(HandleRef handlerRef, IMouseHookUser user, bool enabled)
        {
            MouseHookManager result = new MouseHookManager(handlerRef.Handle, user);

            result.HookMessages = enabled;
            return(result);
        }
Exemple #4
0
        static void Main()
        {
            Application.EnableVisualStyles();
            Application.SetCompatibleTextRenderingDefault(false);
            Application.ThreadException += new System.Threading.ThreadExceptionEventHandler(Application_ThreadException);

            _icon = new NotifyIcon();
            //load the icon
            using (Stream s = System.Reflection.Assembly.GetExecutingAssembly().GetManifestResourceStream("AnAppADay.MouseHeatMap.WinApp.App.ico"))
            {
                _icon.Icon = new Icon(s);
            }

            MenuItem[] items = new MenuItem[3];
            items[0]        = new MenuItem("View Heat Map");
            items[0].Click += new EventHandler(ViewMap_Click);
            items[1]        = new MenuItem("About");
            items[1].Click += new EventHandler(About_Click);
            items[2]        = new MenuItem("Exit");
            items[2].Click += new EventHandler(Exit_Click);
            ContextMenu menu = new ContextMenu(items);

            _icon.ContextMenu = menu;
            _icon.Visible     = true;

            _dictionary = new Dictionary <Point, int>();

            _mgr = new MouseHookManager();
            _mgr.OnMouseActivity += new MouseEventHandler(_mgr_OnMouseActivity);

            Application.Run();
        }
Exemple #5
0
 private static void StartScreenSaver()
 {
     _keyHook                    = new KeyHookManager();
     _keyHook.KeyDown           += new KeyEventHandler(_keyHook_KeyDown);
     _mouseHook                  = new MouseHookManager();
     _mouseHook.OnMouseActivity += new MouseEventHandler(_mouseHook_OnMouseActivity);
     for (int i = 0; i < Screen.AllScreens.Length; i++)
     {
         new Thread(new ParameterizedThreadStart(delegate(object o)
         {
             Go((int)o);
         })).Start(i);
     }
 }
Exemple #6
0
        private void Form1_KeyDown(object sender, KeyEventArgs e)
        {
            if (e.KeyCode == Keys.F2)
            {
                TwoPoint temp = Start();
                Microsoft.Xna.Framework.Input.Mouse.SetPosition((temp.a.X * Stride) + InitialPosition.X, (temp.a.Y * Stride) + InitialPosition.Y);
                MouseHookManager.mouse_event(0x02 | 0x04, (uint)temp.a.X, (uint)temp.a.Y, 0, 0);

                //System.Threading.Thread.Sleep(500);

                Microsoft.Xna.Framework.Input.Mouse.SetPosition((temp.b.X * Stride) + InitialPosition.X, (temp.b.Y * Stride) + InitialPosition.Y);
                MouseHookManager.mouse_event(0x02 | 0x04, (uint)temp.b.X, (uint)temp.b.Y, 0, 0);

                //System.Threading.Thread.Sleep(500);

                Microsoft.Xna.Framework.Input.Mouse.SetPosition(InitialPosition.X, InitialPosition.Y);

                System.Threading.Thread.Sleep(50);
                NativeWin32.SetForegroundWindow(this.Handle);
            }
        }
 public static MouseHookManager HookMouse(IMouseHookUser user, bool enabled)
 {
     MouseHookManager result = new MouseHookManager(IntPtr.Zero, user);
     result.HookMessages = enabled;
     return result;
 }
 public static MouseHookManager HookMouse(HandleRef handlerRef, IMouseHookUser user, bool enabled)
 {
     MouseHookManager result = new MouseHookManager(handlerRef.Handle, user);
     result.HookMessages = enabled;
     return result;
 }
 public MessageHookObject(MouseHookManager parent)
 {
     this.reference = parent;
 }
 public MessageHookObject(MouseHookManager parent)
 {
     this.reference = parent;
 }
Exemple #11
0
        public MainForm()
        {
            InitializeComponent();

            #region initilaizeRandomVars
            m_MasterList = new List <List <string> >();
            m_TempList   = new List <List <string> >();
            m_Indicies   = new List <int>();
            wordIndex    = 1;

            LogFileName     = "Log.txt";
            m_StringBuilder = new StringBuilder();
            new StreamWriter(LogFileName);

            m_MyHWND  = this.Handle;
            DockMouse = true;

            this.Opacity = 80;

            char[] alphabet = { 'a', 'b', 'c', 'd', 'e', 'f', 'g', 'h', 'i', 'j', 'k', 'l', 'm', 'n', 'o', 'p', 'q', 'r', 's', 't', 'u', 'v', 'w', 'x', 'y', 'z' };
            m_Alphabet = alphabet;
            #endregion

            #region threads
            HWndThread = new Thread(new ThreadStart(WatchHWNDs));
            HWndThread.IsBackground = true;
            HWndThread.Start();
            #endregion

            #region KeyboardAndMouseManagers
            m_MouseManager = new MouseHookManager();
            m_MouseManager.OnMouseActivity += new MouseEventHandler(MouseManager_Activity);
            m_MouseManager.Start();

            m_KeyboardManager          = new KeyHookManager();
            m_KeyboardManager.KeyDown += new KeyEventHandler(KeyboardManager_KeyDown);
            m_KeyboardManager.Start();
            #endregion

            #region SystemTray
            m_Icon = new NotifyIcon();

            m_Icon.Icon = Properties.Resources.keyboard;

            MenuItem[] items = new MenuItem[4];
            items[3]        = new MenuItem("Exit");
            items[3].Click += new EventHandler(Exit);
            items[2]        = new MenuItem("About");
            items[2].Click += new EventHandler(About_Click);
            items[1]        = new MenuItem("Update");
            items[1].Click += new EventHandler(Update_Click);
            items[0]        = new MenuItem("Customize");
            items[0].Click += new EventHandler(Customize_Click);

            m_Icon.ContextMenu    = new ContextMenu(items);
            m_Icon.Visible        = true;
            m_Icon.BalloonTipIcon = ToolTipIcon.Info;
            m_Icon.BalloonTipText = "ZTyper";
            //m_Icon.BalloonTipClicked += new EventHandler(m_Icon_MouseClick);
            //m_Icon.MouseClick += new MouseEventHandler(m_Icon_MouseClick);
            m_Icon.Text = this.Text;

            #endregion

            #region initialSorting
            using (StringReader sr = new StringReader(Properties.Resources.words))
            {
                char   currentLetter = 'a';
                string line;
                int    index = 0;
                m_MasterList.Add(new List <string>());

                while ((line = sr.ReadLine()) != null)
                {
                    if (line[0] != currentLetter)
                    {
                        index++;
                        int temp = (int)currentLetter;
                        temp++;
                        currentLetter = (char)temp;
                        m_MasterList.Add(new List <string>());
                    }
                    m_MasterList[index].Add(line);
                }
                m_TempList = new List <List <string> >(m_MasterList);
            }
            #endregion
        }
Exemple #12
0
        public MainForm()
        {
            InitializeComponent();

            #region initilaizeRandomVars
            m_MasterList = new List<List<string>>();
            m_TempList = new List<List<string>>();
            m_Indicies = new List<int>();
            wordIndex = 1;

            LogFileName = "Log.txt";
            m_StringBuilder = new StringBuilder();
            new StreamWriter(LogFileName);

            m_MyHWND = this.Handle;
            DockMouse = true;

            this.Opacity = 80;

            char[] alphabet = { 'a', 'b', 'c', 'd', 'e', 'f', 'g', 'h', 'i', 'j', 'k', 'l', 'm', 'n', 'o', 'p', 'q', 'r', 's', 't', 'u', 'v', 'w', 'x', 'y', 'z' };
            m_Alphabet = alphabet;
            #endregion

            #region threads
            HWndThread = new Thread(new ThreadStart(WatchHWNDs));
            HWndThread.IsBackground = true;
            HWndThread.Start();
            #endregion

            #region KeyboardAndMouseManagers
            m_MouseManager = new MouseHookManager();
            m_MouseManager.OnMouseActivity += new MouseEventHandler(MouseManager_Activity);
            m_MouseManager.Start();

            m_KeyboardManager = new KeyHookManager();
            m_KeyboardManager.KeyDown += new KeyEventHandler(KeyboardManager_KeyDown);
            m_KeyboardManager.Start();
            #endregion

            #region SystemTray
            m_Icon = new NotifyIcon();

            m_Icon.Icon = Properties.Resources.keyboard;

            MenuItem[] items = new MenuItem[4];
            items[3] = new MenuItem("Exit");
            items[3].Click += new EventHandler(Exit);
            items[2] = new MenuItem("About");
            items[2].Click += new EventHandler(About_Click);
            items[1] = new MenuItem("Update");
            items[1].Click += new EventHandler(Update_Click);
            items[0] = new MenuItem("Customize");
            items[0].Click += new EventHandler(Customize_Click);

            m_Icon.ContextMenu = new ContextMenu(items);
            m_Icon.Visible = true;
            m_Icon.BalloonTipIcon = ToolTipIcon.Info;
            m_Icon.BalloonTipText = "ZTyper";
            //m_Icon.BalloonTipClicked += new EventHandler(m_Icon_MouseClick);
            //m_Icon.MouseClick += new MouseEventHandler(m_Icon_MouseClick);
            m_Icon.Text = this.Text;

            #endregion

            #region initialSorting
            using (StringReader sr = new StringReader(Properties.Resources.words))
            {
                char currentLetter = 'a';
                string line;
                int index = 0;
                m_MasterList.Add(new List<string>());

                while ((line = sr.ReadLine()) != null)
                {
                    if (line[0] != currentLetter)
                    {
                        index++;
                        int temp = (int)currentLetter;
                        temp++;
                        currentLetter = (char)temp;
                        m_MasterList.Add(new List<string>());
                    }
                    m_MasterList[index].Add(line);
                }
                m_TempList = new List<List<string>>(m_MasterList);
            }
            #endregion
        }