/// <summary> /// Initializes a new instance of the MainViewModel class. /// </summary> public MainViewModel() { CloseCommand = new RelayCommand <Window>(CloseClick); HookCommand = new RelayCommand(HookClick); _interceptMouse = new InterceptMouse(); if (IsInDesignMode) { return; } HookClick(); _interceptMouse.MouseHookLeftButtonDown += (sender, args) => { Dispatcher.CurrentDispatcher.InvokeAsync(() => { _dv?.Close(); _dv = null; GetPixel(args); }); _interceptMouse.Unhook(); RaisePropertyChanged(nameof(Hooked)); }; _interceptMouse.MouseHookMove += (sender, args) => Dispatcher.CurrentDispatcher.InvokeAsync(() => GetPixel(args)); }
public LoggerViewModel() { // initialize the screen counter matrix double w = SystemParameters.PrimaryScreenWidth; double h = SystemParameters.PrimaryScreenHeight; _width = (int)w / CellWidth; _height = (int)h / CellHeight; _screenCount = new int[_width, _height]; _directionCount = new int[360]; _speedCount = new int[100]; InitBitmap(); _lastPoint = WindowHelper.GetCursorPos(); watch = new Stopwatch(); watch.Start(); _timer = new DispatcherTimer(); _timer.Interval = TimeSpan.FromMilliseconds(100); _timer.Tick += timer_Tick; _timer.Start(); Hook.CreateKeyboardHook(KeyReader); _keys = new InterceptKeys(); _mouse = new InterceptMouse(MouseHandler); }
private void unlock_socket_tread() { Socket Server_s = new Socket(AddressFamily.InterNetwork, SocketType.Stream, ProtocolType.Tcp); IPEndPoint iplocal = new IPEndPoint(IPAddress.Any, 9988); Socket client_s; IPEndPoint newclient; ASCIIEncoding asen = new ASCIIEncoding(); byte[] data = new byte[512]; Server_s.Bind(iplocal); Server_s.Listen(1); client_s = Server_s.Accept(); newclient = (IPEndPoint)client_s.RemoteEndPoint; client_s.Receive(data); STATE = System.Text.Encoding.UTF8.GetString(data); if (int.Parse(STATE) == 0) { MouseBlockUnlock(); InterceptMouse.End(); Kill.Abort(); this.Invoke(new MethodInvoker(delegate() { this.Visible = false; })); MessageBox.Show(STATE); Server_s.Close(); this.Invoke(new MethodInvoker(delegate() { this.timer_event(); })); } Server_s.Close(); } // 서버로써 클라이언트에서 언락 데이터 받음
protected override void OnSourceInitialized(EventArgs e) { _handle = (new WindowInteropHelper(this)).Handle; // set desktop WindowDesktopBind.SetDesktopAsParent(_handle); // set hook InterceptMouse._window = this; InterceptMouse._hookID = InterceptMouse.SetHook(InterceptMouse._proc); InterceptKey._window = this; InterceptKey._hookID = InterceptKey.SetHook(InterceptKey._proc); // set size double x1 = SystemParameters.PrimaryScreenWidth; //得到屏幕宽度 double y1 = SystemParameters.PrimaryScreenHeight; //得到屏幕高度 this.Left = 0; this.Top = 0; this.Height = y1; this.Width = x1; _chromiumWebBrowser.GetBrowser().GetHost().WindowlessFrameRate = 30; }
static void Main(string[] args) { Task task1 = Task.Factory.StartNew(() => InterceptKeyboard.Start()); Task task2 = Task.Factory.StartNew(() => InterceptMouse.Start()); Task.WaitAll(task1, task2); Console.WriteLine("All threads complete"); }
// private List<string> words = commaWords.Split(','); public FindImageInScreenShot() { this.InitializeComponent(); this.screenShotsManager = new ScreenShotsManager(); InterceptKeys.OnKeyDown += this.InterceptKeys_OnKeyDown; InterceptKeys.Start(); InterceptMouse.OnMouseLeftButtonDown += this.InterceptMouse_OnMouseLeftButtonDown; InterceptMouse.Start(); }
} // 인터페이스 설정 private void LOCK() { InterceptMouse.Start(); // 마우스 블락 MouseBlockLock(); SendtoServer_lock(); ThreadTask(); // 작업관리자 프로세스 끝내기 스레드 timer.Stop(); } //PC락
protected override bool ProcessCmdKey(ref Message msg, Keys keyData) // 키보드 후킹 { if (keyData == (Keys.Alt | Keys.F4)) { MouseBlockUnlock(); InterceptMouse.End(); Kill.Abort(); this.Visible = false; MessageBox.Show("Alt + F4 catched!"); //MessageBox.Show(GetMacAddress() + " " + GetIPAddress()); timer_event(); return(true); } else { return(base.ProcessCmdKey(ref msg, keyData)); } }
private void FindImageInScreenShot_FormClosing(object sender, FormClosingEventArgs e) { InterceptKeys.Stop(); InterceptMouse.Stop(); AudioPlaybackEngine.Instance.Dispose(); }
private void Form1_Load(object sender, EventArgs e) { InterceptMouse.Start(this); }
public MouseService() { InterceptMouse.Start(); }