Ejemplo n.º 1
0
// NewIconFromFile returns a new Icon, using the specified icon image file.
func NewIconFromFile(filePath string) (*Icon, error) {
	absFilePath, err := filepath.Abs(filePath)
	if err != nil {
		return nil, wrapError(err)
	}

	hIcon := win.HICON(win.LoadImage(
		0,
		syscall.StringToUTF16Ptr(absFilePath),
		win.IMAGE_ICON,
		0,
		0,
		win.LR_DEFAULTSIZE|win.LR_LOADFROMFILE))
	if hIcon == 0 {
		return nil, lastError("LoadImage")
	}

	return &Icon{hIcon: hIcon}, nil
}
Ejemplo n.º 2
0
func (cc customCursor) Dispose() {
	win.DestroyIcon(win.HICON(cc.hCursor))
}