Beispiel #1
0
 private static IntPtr CurrentHandle()
 {
     return(Win32.GetThreadDesktop(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());
     }
 }