(mod windows.Handle)
| 175 | } |
| 176 | |
| 177 | func (s *Systray) loadIconFromResource(mod windows.Handle) (windows.Handle, error) { |
| 178 | // find the icon in the same directory where the binary is loaded |
| 179 | exe, err := os.Executable() |
| 180 | if err != nil { |
| 181 | return windows.InvalidHandle, err |
| 182 | } |
| 183 | ico, err := sys.LoadImage( |
| 184 | mod, |
| 185 | windows.StringToUTF16Ptr(filepath.Join(filepath.Dir(exe), "fibratus.ico")), |
| 186 | 1, // load icon |
| 187 | 0, |
| 188 | 0, |
| 189 | sys.LoadResourceDefaultSize|sys.LoadResourceFromFile, |
| 190 | ) |
| 191 | if err != nil { |
| 192 | // load stock informational system icon |
| 193 | var icon sys.ShStockIcon |
| 194 | icon.Size = uint32(unsafe.Sizeof(icon)) |
| 195 | err := sys.SHGetStockIconInfo(79, 0x000000100, &icon) |
| 196 | if err != nil { |
| 197 | return windows.InvalidHandle, fmt.Errorf("unable to load systray icon resource: %v", err) |
| 198 | } |
| 199 | ico = windows.Handle(icon.Icon) |
| 200 | } |
| 201 | return ico, nil |
| 202 | } |
| 203 | |
| 204 | func (s *Systray) handlePipeClient(conn net.Conn) { |
| 205 | defer conn.Close() |
no test coverage detected