public CompareForm() { InitializeComponent(); elemManage = new ElementManage(); //form1 = new Form1(); //callbackMsg = new CallBackMessage(form1._GetMessageFrom); //System.IntPtr DesktopHandle = GetDC(System.IntPtr.Zero); //g = Graphics.FromHdc(DesktopHandle); //threadFlag = false; }
//CompareForm dialogFrom; //private AutomationEventHandler UIAEventHandler; //private AutomationFocusChangedEventHandler focusHandler = null; //private bool comboBoxFlag = true; //private bool stopFlag = true; public Form1() { InitializeComponent(); Control.CheckForIllegalCrossThreadCalls = false; // Instantiate our GlobalHooks object _GlobalHooks = new GlobalHooks(this.Handle); // Set the hook events _GlobalHooks.CBT.Activate += new GlobalHooksTest.GlobalHooks.WindowEventHandler(_GlobalHooks_CbtActivate); _GlobalHooks.CBT.CreateWindow += new GlobalHooksTest.GlobalHooks.WindowEventHandler(_GlobalHooks_CbtCreateWindow); _GlobalHooks.CBT.DestroyWindow += new GlobalHooksTest.GlobalHooks.WindowEventHandler(_GlobalHooks_CbtDestroyWindow); _GlobalHooks.CBT.MoveSize += new GlobalHooksTest.GlobalHooks.WindowEventHandler(_GlobalHooks_CbtMoveSize); _GlobalHooks.CBT.SetFocus += new GlobalHooksTest.GlobalHooks.WindowEventHandler(_GlobalHooks_CbtSetFocus); _GlobalHooks.CBT.SysCommand += new GlobalHooksTest.GlobalHooks.SysCommandEventHandler(_GlobalHooks_SysCommand); //_GlobalHooks.Shell.WindowActivated += new GlobalHooksTest.GlobalHooks.WindowEventHandler(_GlobalHooks_ShellWindowActivated); _GlobalHooks.Shell.WindowCreated += new GlobalHooksTest.GlobalHooks.WindowEventHandler(_GlobalHooks_ShellWindowCreated); //_GlobalHooks.Shell.WindowDestroyed += new GlobalHooksTest.GlobalHooks.WindowEventHandler(_GlobalHooks_ShellWindowDestroyed); //_GlobalHooks.Shell.Redraw += new GlobalHooksTest.GlobalHooks.WindowEventHandler(_GlobalHooks_ShellRedraw); _GlobalHooks.MouseLL.MouseMove += new MouseEventHandler(MouseLL_MouseMove); _GlobalHooks.MouseLL.MouseDown += new MouseEventHandler(MouseLL_MouseDown); _GlobalHooks.MouseLL.MouseUp += new MouseEventHandler(MouseLL_MouseUp); _GlobalHooks.MouseLL.MouseDoubleClick += new MouseEventHandler(MouseLL_MouseDClick); _GlobalHooks.KeyboardLL.KeyDown += new KeyEventHandler(KeyboardLL_KeyDown); _GlobalHooks.KeyboardLL.KeyUp += new KeyEventHandler(KeyboardLL_KeyUp); _GlobalHooks.CallWndProc.CallWndProc += new GlobalHooksTest.GlobalHooks.WndProcEventHandler(_GlobalHooks_CallWndProc); _GlobalHooks.SysMsgFilter.Menu += new GlobalHooksTest.GlobalHooks.WindowEventHandler(_GlobalHooks_SysMsgFilterMenu); _GlobalHooks.SysMsgFilter.DialogBox += new GlobalHooksTest.GlobalHooks.WindowEventHandler(_GlobalHooks_SysMsgFilterDialogBox); _GlobalHooks.GetMsg.GetMsg += new GlobalHooksTest.GlobalHooks.WndProcEventHandler(_GlobalHooks_GetMsg); elemManage = new ElementManage(); //compareForm = new CompareForm(); elemManage.SendMessageBack += new ElementManage.CallBackMessage(_GetMessage); //compareForm.SendMessageBack += new CompareForm.CallBackMessage(_GetMessageFrom); //filePath = elemManage.GetUserPath(); this.textBox2.Text = elemManage.GetUserPath(); // //DialogCloseEvent += new DialogCloseListener(StartHook); //AutomationEventHandler eventHandler = new AutomationEventHandler(elemManage.OnWindowOpenOrClose); //_GlobalFlag = false; //Automation.AddAutomationEventHandler(WindowPattern.WindowOpenedEvent, AutomationElement.RootElement, TreeScope.Children, eventHandler); }