private static void CheckHook(object obj, EventArgs args) { HOOK old_hook = m_hook; // Reinstall the hook in case Windows disabled it without telling us. It’s // OK to have two hooks installed for a short time, because we check for // recursive calls to ourselves in OnKey(). if (m_active) { m_hook = NativeMethods.SetWindowsHookEx(WH.KEYBOARD_LL, m_callback, NativeMethods.LoadLibrary("user32.dll"), 0); if (m_hook == HOOK.INVALID) { Log.Debug("Unable to install hook: {0}", new Win32Exception(Marshal.GetLastWin32Error())); } } else { m_hook = HOOK.INVALID; } if (old_hook != HOOK.INVALID) { // XXX: this will crash if the hook is not removed from the same // thread that installed it. int ret = NativeMethods.UnhookWindowsHookEx(old_hook); if (ret == 0) { Log.Debug("Unable to uninstall hook: {0}", new Win32Exception(Marshal.GetLastWin32Error())); } } }
@OrphanageFourThree() { this.StartPassage = "Under the Orphanage"; base.Vars = new VarDefs() { Story = this, StrictMode = true }; macros1 = new Cradle.StoryFormats.Harlowe.HarloweRuntimeMacros() { Story = this }; macros2 = new HOOK() { Story = this }; macros3 = new DialogueEnder() { Story = this }; macros4 = new GlobalVarMacros() { Story = this }; base.Init(); passage1_Init(); passage2_Init(); passage3_Init(); passage4_Init(); passage5_Init(); passage6_Init(); passage7_Init(); }
@OrphanageThirteen() { this.StartPassage = "Diner with Waitress"; base.Vars = new VarDefs() { Story = this, StrictMode = true }; macros1 = new Cradle.StoryFormats.Harlowe.HarloweRuntimeMacros() { Story = this }; macros2 = new HOOK() { Story = this }; macros3 = new DialogueEnder() { Story = this }; macros4 = new GlobalVarMacros() { Story = this }; base.Init(); passage1_Init(); passage2_Init(); passage3_Init(); passage4_Init(); passage5_Init(); passage6_Init(); passage7_Init(); }
private static void CheckHook(bool must_reinstall) { HOOK old_hook = m_hook; // Reinstall the hook in case Windows disabled it without telling us. It’s // OK to have two hooks installed for a short time, because we check for // recursive calls to ourselves in OnKey(). if (must_reinstall) { m_hook = NativeMethods.SetWindowsHookEx(WH.KEYBOARD_LL, m_callback, NativeMethods.LoadLibrary("user32.dll"), 0); if (m_hook == HOOK.INVALID) { Log.Debug("Unable to install hook: {0}", new Win32Exception(Marshal.GetLastWin32Error())); } } else { m_hook = HOOK.INVALID; } if (old_hook != HOOK.INVALID) { // XXX: this will crash if the hook is not removed from the same // thread that installed it. int ret = NativeMethods.UnhookWindowsHookEx(old_hook); if (ret == 0) { Log.Debug("Unable to uninstall hook: {0}", new Win32Exception(Marshal.GetLastWin32Error())); } } }
@OrphanageNine() { this.StartPassage = "Inn with innkeeper"; base.Vars = new VarDefs() { Story = this, StrictMode = true }; macros1 = new Cradle.StoryFormats.Harlowe.HarloweRuntimeMacros() { Story = this }; macros2 = new HOOK() { Story = this }; macros3 = new DialogueEnder() { Story = this }; macros4 = new GlobalVarMacros() { Story = this }; base.Init(); passage1_Init(); passage2_Init(); passage3_Init(); passage4_Init(); passage5_Init(); }
@OrphanageEightTwo() { this.StartPassage = "Laboratory with Sheriff"; base.Vars = new VarDefs() { Story = this, StrictMode = true }; macros1 = new Cradle.StoryFormats.Harlowe.HarloweRuntimeMacros() { Story = this }; macros2 = new HOOK() { Story = this }; macros3 = new DialogueEnder() { Story = this }; macros4 = new GlobalVarMacros() { Story = this }; base.Init(); passage1_Init(); passage2_Init(); passage3_Init(); passage4_Init(); passage5_Init(); passage6_Init(); passage7_Init(); passage8_Init(); passage9_Init(); passage10_Init(); passage11_Init(); passage12_Init(); passage13_Init(); passage14_Init(); passage15_Init(); passage16_Init(); passage17_Init(); passage18_Init(); passage19_Init(); passage20_Init(); passage21_Init(); passage22_Init(); passage23_Init(); passage24_Init(); }
public static void Init() { if (Environment.OSVersion.Platform == PlatformID.Win32NT || Environment.OSVersion.Platform == PlatformID.Win32S || Environment.OSVersion.Platform == PlatformID.Win32Windows || Environment.OSVersion.Platform == PlatformID.WinCE) { m_callback = OnKey; // Keep a reference on OnKey m_hook = NativeMethods.SetWindowsHookEx(WH.KEYBOARD_LL, m_callback, NativeMethods.LoadLibrary("user32.dll"), 0); if (m_hook == HOOK.INVALID) throw new Win32Exception(Marshal.GetLastWin32Error()); } }
@Rainbow() { this.StartPassage = "Rainbow"; base.Vars = new VarDefs() { Story = this, StrictMode = true }; macros1 = new Cradle.StoryFormats.Harlowe.HarloweRuntimeMacros() { Story = this }; macros2 = new HOOK() { Story = this }; macros3 = new DialogueEnder() { Story = this }; macros4 = new GlobalVarMacros() { Story = this }; base.Init(); passage1_Init(); passage2_Init(); passage3_Init(); passage4_Init(); passage5_Init(); passage6_Init(); passage7_Init(); passage8_Init(); passage9_Init(); passage10_Init(); passage11_Init(); passage12_Init(); passage13_Init(); passage14_Init(); passage15_Init(); passage16_Init(); passage17_Init(); passage18_Init(); passage19_Init(); passage20_Init(); passage21_Init(); }
@OrphanageTwelve() { this.StartPassage = "Facility wit Orphan"; base.Vars = new VarDefs() { Story = this, StrictMode = true }; macros1 = new Cradle.StoryFormats.Harlowe.HarloweRuntimeMacros() { Story = this }; macros2 = new HOOK() { Story = this }; macros3 = new DialogueEnder() { Story = this }; macros4 = new GlobalVarMacros() { Story = this }; base.Init(); passage1_Init(); passage2_Init(); passage3_Init(); passage4_Init(); passage5_Init(); passage6_Init(); passage7_Init(); passage8_Init(); passage9_Init(); passage10_Init(); passage11_Init(); passage12_Init(); passage13_Init(); passage14_Init(); passage15_Init(); }
@PastorMikeButno() { this.StartPassage = "Start"; base.Vars = new VarDefs() { Story = this, StrictMode = true }; macros1 = new Cradle.StoryFormats.Harlowe.HarloweRuntimeMacros() { Story = this }; macros2 = new HOOK() { Story = this }; macros3 = new DialogueEnder() { Story = this }; macros4 = new GlobalVarMacros() { Story = this }; base.Init(); passage1_Init(); passage2_Init(); passage3_Init(); passage4_Init(); passage5_Init(); passage6_Init(); passage7_Init(); passage8_Init(); passage9_Init(); passage10_Init(); passage11_Init(); }
public void setHOOK(HOOK type, bool on) => plugin.setHook((int)type, on);
public void HOOK_launchProgram(HOOK devices = HOOK.BOTH) => plugin.setHookProgram((int)devices);
public static extern int CallNextHookEx(HOOK hhk, HC nCode, WM wParam, IntPtr lParam);
public static extern int UnhookWindowsHookEx(HOOK hhk);
public void HOOK_setDeviceState(HOOK devices = HOOK.BOTH, bool state = true) => plugin.setHook((int)devices, state);
public static void Fini() { // XXX: this will crash if called from the GC Finalizer Thread because // the hook needs to be removed from the same thread that installed it. if (m_hook != HOOK.INVALID) { int ret = NativeMethods.UnhookWindowsHookEx(m_hook); if (ret == 0) throw new Win32Exception(Marshal.GetLastWin32Error()); m_hook = HOOK.INVALID; } m_callback = null; }