private void BeginListening() { if (!listening) { listening = true; callback = new Win32.CBTCallback(ModalListener); handleToHook = Win32.SetWindowsHookEx(CbtHookType, callback, IntPtr.Zero, Win32.GetCurrentThreadId()); } }
private void BeginListening() { if (this.m_Listening == false) { this.m_Listening = true; this.m_Callback = Callback_ModalListener; this.m_HanderToHook = Win32.SetWindowsHookEx(HCBT_ACTIVATE, this.m_Callback, IntPtr.Zero, Win32.GetCurrentThreadId()); } }
private void BeginListening() { if (!listening) { listening = true; // Note: the callback is saved as a member to keep the CLR from shuffling off the pointer // before the callback is used. // If we try to assign the call back "inline" we get memory violation errors. callback = Callback_ModalListener; handleToHook = Win32.SetWindowsHookEx(HCBT_ACTIVATE, callback, IntPtr.Zero, Win32.GetCurrentThreadId()); } }
internal DialogExpectation(System.Windows.Forms.Form HostingForm) { this.m_Handers = new HandlerCollection(); this.m_Callback = null; this.m_HanderToHook = IntPtr.Zero; this.m_hWndList = new List <IntPtr>(); this.m_Listening = false; this.m_ExpectAllDialog = false; this.m_ExpectAllMessageBox = false; this.m_UnexpectedCalllback = DefaultUnexpectedCallback; this.m_HostingForm = HostingForm; this.BeginListening(); }