using System; using System.Runtime.InteropServices; namespace MangaReader.Avalonia.Platform.Win.Interop { /// /// Win32 API imports. /// internal static class WinApi { private const string User32 = "user32.dll"; /// /// Creates, updates or deletes the taskbar icon. /// [DllImport("shell32.Dll", CharSet = CharSet.Unicode)] public static extern bool Shell_NotifyIcon(NotifyCommand cmd, [In] ref NotifyIconData data); /// /// Creates the helper window that receives messages from the taskar icon. /// [DllImport(User32, EntryPoint = "CreateWindowExW", SetLastError = true)] public static extern IntPtr CreateWindowEx(int dwExStyle, [MarshalAs(UnmanagedType.LPWStr)] string lpClassName, [MarshalAs(UnmanagedType.LPWStr)] string lpWindowName, int dwStyle, int x, int y, int nWidth, int nHeight, IntPtr hWndParent, IntPtr hMenu, IntPtr hInstance, IntPtr lpParam); /// /// Processes a default windows procedure. /// [DllImport(User32)] public static extern IntPtr DefWindowProc(IntPtr hWnd, uint msg, IntPtr wparam, IntPtr lparam); /// /// Registers the helper window class. /// [DllImport(User32, EntryPoint = "RegisterClassW", SetLastError = true)] public static extern short RegisterClass(ref WindowClass lpWndClass); /// /// Registers a listener for a window message. /// /// /// uint [DllImport(User32, EntryPoint = "RegisterWindowMessageW")] public static extern uint RegisterWindowMessage([MarshalAs(UnmanagedType.LPWStr)] string lpString); /// /// Used to destroy the hidden helper window that receives messages from the /// taskbar icon. /// /// /// bool [DllImport(User32, SetLastError = true)] public static extern bool DestroyWindow(IntPtr hWnd); } }