예제 #1
0
 protected virtual void DestroyWindowClassCore()
 {
     if (_wndClassAtom != 0)
     {
         var moduleHandle = InteropMethods.GetModuleHandle(null);
         InteropMethods.UnregisterClass(new IntPtr(_wndClassAtom), moduleHandle);
         _wndClassAtom = 0;
     }
 }
예제 #2
0
        private static IntPtr SetHook(InteropValues.HookProc proc)
        {
            using var curProcess = Process.GetCurrentProcess();
            using var curModule  = curProcess.MainModule;

            if (curModule != null)
            {
                return(InteropMethods.SetWindowsHookEx((int)InteropValues.HookType.WH_KEYBOARD_LL, proc,
                                                       InteropMethods.GetModuleHandle(curModule.ModuleName), 0));
            }
            return(IntPtr.Zero);
        }