You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Logger.Warn($"Error calling UnregisterHotKey on hokey with id {HotkeyInfo.HookId} for command of type {Command.GetType()}; the error was {Marshal.GetLastWin32Error()}; going to delete the atom anyway... The memory may leak.");
75
+
}
76
+
Kernel32.SetLastError(Kernel32.ERROR_SUCCESS);
72
77
Kernel32.GlobalDeleteAtom(HotkeyInfo.HookId);
78
+
varlastError=Marshal.GetLastWin32Error();
79
+
if(lastError!=Kernel32.ERROR_SUCCESS)
80
+
{
81
+
Logger.Warn($"Error calling DeleteGlobalAtom; the error was {lastError}, the id {HotkeyInfo.HookId} and the type of the associated command {Command.GetType()}.");
/// Retrieves a module handle for the specified module.
35
-
/// The module must have been loaded by the calling process.
34
+
/// Sets the last-error code for the calling thread.
36
35
/// </summary>
37
-
/// <param name="lpModuleName">The name of the loaded module (either a .dll or .exe file).
38
-
/// If the file name extension is omitted, the default library extension .dll is appended.
39
-
/// The file name string can include a trailing point character (.) to indicate that the module name has no extension.
40
-
/// The string does not have to specify a path. When specifying a path, be sure to use backslashes (\), not forward slashes (/).
41
-
/// The name is compared (case independently) to the names of modules currently mapped into the address space of the calling process.</param>
42
-
/// <returns>If the function succeeds, the return value is a handle to the specified module.
43
-
/// If the function fails, the return value is NULL. To get extended error information, call GetLastError.</returns>
44
-
/// <remarks>The returned handle is not global or inheritable. It cannot be duplicated or used by another process.
45
-
/// This function must be used carefully in a multithreaded application. There is no guarantee that the module handle remains valid between the time this function returns the handle and the time it is used.
46
-
/// For example, suppose that a thread retrieves a module handle, but before it uses the handle, a second thread frees the module.
47
-
/// If the system loads another module, it could reuse the module handle that was recently freed.
48
-
/// Therefore, the first thread would have a handle to a different module than the one intended.
/// Retrieves a handle to the foreground window (the window with which the user is currently working).
57
-
/// The system assigns a slightly higher priority to the thread that creates the foreground window than it does to other threads.
58
-
/// </summary>
59
-
/// <returns>The return value is a handle to the foreground window.
60
-
/// The foreground window can be NULL in certain circumstances, such as when a window is losing activation.</returns>
61
-
[DllImport("user32.dll")]
62
-
publicstaticexternIntPtrGetForegroundWindow();
63
-
64
-
/// <summary>
65
-
/// Retrieves the name of the class to which the specified window belongs.
66
-
/// </summary>
67
-
/// <param name="hWnd">A handle to the window and, indirectly, the class to which the window belongs.</param>
68
-
/// <param name="lpClassName">The class name string (maximum 256 characters).</param>
69
-
/// <param name="nMaxCount">The length of the lpClassName buffer, in characters.
70
-
/// The buffer must be large enough to include the terminating null character; otherwise, the class name string is truncated to nMaxCount-1 characters.</param>
71
-
/// <returns>If the function succeeds, the return value is the number of characters copied to the buffer, not including the terminating null character.
72
-
/// If the function fails, the return value is zero. To get extended error information, call GetLastError.</returns>
0 commit comments