Pastebin launched a little side project called VERYVIRAL.com, check it out ;-) Want more features on Pastebin? Sign Up, it's FREE!
Guest

Zolomon

By: a guest on Jan 15th, 2010  |  syntax: C#  |  size: 2.37 KB  |  views: 59  |  expires: Never
download  |  raw  |  embed  |  report abuse  |  print
Text below is selected. Please press Ctrl+C to copy to your clipboard. (⌘+C on Mac)
  1. using System;
  2. using System.Collections.Generic;
  3. using System.Collections.Specialized;
  4. using System.Collections;
  5. using System.ComponentModel;
  6. using System.Data;
  7. using System.Drawing;
  8. using System.Text;
  9. using System.Windows.Forms;
  10. using System.Runtime.InteropServices;
  11. using System.Diagnostics;
  12. using MouseHook;
  13.  
  14. namespace KeyboardTracker
  15. {
  16.     public partial class mainForm : Form
  17.     {    
  18.         public mainForm()
  19.         {
  20.             InitializeComponent();
  21.             EventThief et = new EventThief();
  22.             // This is where I can't get any further - how do I translate the 'with' operator ? It says et.LEFT_UP is a short so I can't set it to true :(
  23.             et.LEFT_UP = true;
  24.         }
  25.  
  26.         private TracerClass MyMouseHunter = new TracerClass();
  27.  
  28.         //* Tracking the system wide mouse events
  29.         private void MyMouseHunter_OnSystemMouseMove()
  30.         {
  31.             //* Choose anything you want to trace when your mouse moves
  32.             //* You can trace the X and Y coordinate of your mouse position in the window
  33.             //* Or the Window handle (hWnd) { of the window under your mouse
  34.             //* Or the Window title (Caption) { under your mouse.
  35.  
  36.             //lblWindowTitle.Caption = MyMouseHunter.CoordinateX & "," & MyMouseHunter.CoordinateY
  37.             //lblWindowTitle.Caption = MyMouseHunter.WindowHandleUnderMouse
  38.             this.Text = MyMouseHunter.WindowTextUnderMouse;
  39.             Console.WriteLine("Moving...");
  40.         }
  41.  
  42.         private void MyMouseHunter_OnSystemMouseLeftDown()
  43.         {
  44.             Console.WriteLine("Left Down");
  45.         }
  46.  
  47.         private void MyMouseHunter_OnSystemMouseLeftUp()
  48.         {
  49.             Console.WriteLine("Left Up");
  50.         }
  51.  
  52.         private void MyMouseHunter_OnSystemMouseRightDown()
  53.         {
  54.             Console.WriteLine("Right Down");
  55.         }
  56.  
  57.         private void MyMouseHunter_OnSystemMouseRightUp()
  58.         {
  59.             Console.WriteLine("Right Up");
  60.         }
  61.  
  62.         private void MyMouseHunter_OnSystemMouseMiddleDown()
  63.         {
  64.             Console.WriteLine("Middle Down");
  65.         }
  66.  
  67.         private void MyMouseHunter_OnSystemMouseMiddleUp()
  68.         {
  69.             Console.WriteLine("Middle Up");
  70.         }
  71.  
  72.         private void MyMouseHunter_OnSystemMouseWheel()
  73.         {
  74.             Console.WriteLine("Wheel...");
  75.         }
  76.     }
  77. }
clone this paste RAW Paste Data