|
| 1 | +import { |
| 2 | + pointer, out, textDecoder, |
| 3 | + struct, sizeof, |
| 4 | + register, unregister, |
| 5 | + type koffi |
| 6 | +} from '../../private.js' |
| 7 | +import { |
| 8 | + cBOOL, cDWORD, cUINT, cLPWSTR, cLPCWSTR, |
| 9 | +} from '../../ctypes.js' |
| 10 | +import { shell32 } from './_lib.js' |
| 11 | +import { cHWND, type HWND } from '../user32/window.js' |
| 12 | +import { cHICON, type HICON } from '../user32/icon.js' |
| 13 | +import { NIF_, NIM_ } from '../consts.js' |
| 14 | + |
| 15 | +// #region Types |
| 16 | + |
| 17 | +/** |
| 18 | + * Contains information that the system needs to display notifications in the notification area. |
| 19 | + * |
| 20 | + * @link https://learn.microsoft.com/en-us/windows/win32/api/shellapi/ns-shellapi-notifyicondataw |
| 21 | + */ |
| 22 | +export class NOTIFYICONDATA { |
| 23 | + readonly cbSize = sizeof(cNOTIFYICONDATA) |
| 24 | + declare hWnd: HWND |
| 25 | + declare uID: number |
| 26 | + declare uFlags: NIF_ |
| 27 | + declare uCallbackMessage: number |
| 28 | + declare hIcon: HICON |
| 29 | + declare szTip?: string |
| 30 | + declare dwState?: number |
| 31 | + declare dwStateMask?: number |
| 32 | + declare szInfo?: string |
| 33 | + declare uVersion?: number |
| 34 | + declare szInfoTitle?: string |
| 35 | + declare dwInfoFlags?: number |
| 36 | + declare guidItem?: number |
| 37 | + declare hBalloonIcon?: HICON |
| 38 | +} |
| 39 | + |
| 40 | +export const cNOTIFYICONDATA = struct('NOTIFYICONDATA', { |
| 41 | + cbSize: cDWORD, |
| 42 | + hWnd: cHWND, |
| 43 | + uID: cUINT, |
| 44 | + uFlags: cUINT, |
| 45 | + uCallbackMessage: cUINT, |
| 46 | + hIcon: cHICON, |
| 47 | + szTip: cLPWSTR, |
| 48 | + dwState: cDWORD, |
| 49 | + dwStateMask: cDWORD, |
| 50 | + szInfo: cLPWSTR, |
| 51 | + uVersion: cUINT, |
| 52 | + szInfoTitle: cLPWSTR, |
| 53 | + dwInfoFlags: cDWORD, |
| 54 | + guidItem: cDWORD, |
| 55 | + hBalloonIcon: cHICON |
| 56 | +}) |
| 57 | + |
| 58 | +// #region Functions |
| 59 | + |
| 60 | +/** |
| 61 | + * Adds, modifies, or deletes an icon from the taskbar status area. |
| 62 | + * |
| 63 | + * @link https://learn.microsoft.com/en-us/windows/win32/api/shellapi/nf-shellapi-shell_notifyiconw |
| 64 | + */ |
| 65 | +export const Shell_NotifyIcon: koffi.KoffiFunc<( |
| 66 | + dwMessage: NIM_, |
| 67 | + lpData: NOTIFYICONDATA |
| 68 | +) => boolean> = shell32('Shell_NotifyIconW', cBOOL, [ cDWORD, cNOTIFYICONDATA ]) |
0 commit comments