NewSystrayIcon creates a new systray icon instance.
(wnd Hwnd)
| 97 | |
| 98 | // NewSystrayIcon creates a new systray icon instance. |
| 99 | func NewSystrayIcon(wnd Hwnd) (*SystrayIcon, error) { |
| 100 | var data NotifyIconData |
| 101 | data.Size = uint32(unsafe.Sizeof(data)) |
| 102 | data.Flags = NotifyIconGUIDFlag | NotifyIconMessageFlag |
| 103 | data.GUIDItem = SystrayIconGUID |
| 104 | data.HWnd = wnd |
| 105 | |
| 106 | err := ShellNotifyIcon(ShellAddIcon, &data) |
| 107 | si := &SystrayIcon{wnd: wnd} |
| 108 | if err != nil { |
| 109 | return nil, err |
| 110 | } |
| 111 | return si, nil |
| 112 | } |
| 113 | |
| 114 | // SetIcon sets the tray icon. |
| 115 | func (s *SystrayIcon) SetIcon(icon Hicon) error { |
no test coverage detected