func NewIconFromResource(instance win.HINSTANCE, resId uint16) (ico win.HICON, err error) { if ico = win.LoadIcon(instance, win.MAKEINTRESOURCE(uintptr(resId))); ico == 0 { err = errors.New(fmt.Sprintf("Cannot load icon from resource with id %v", resId)) } return ico, err }
func (w *MainWindow) Create(idd uintptr) { if idd == 0 { panic("窗口未设置 Wid") } w.idd = idd w.hwnd = win.CreateDialogParam(hInst, win.MAKEINTRESOURCE(w.idd), 0, defaultDialogProcPtr, 0) fmt.Printf("Create window hwnd=%v\n", w.hwnd) if w.hwnd == win.HWND(0) { fmt.Printf("Create window fail.[%v]\n", idd) } //icon, err := NewIconFromFile("main.ico") //if err == nil { // w.SetIcon(0, icon) //} //w.Hide() }
func IconShield() *Icon { return &Icon{win.LoadIcon(0, win.MAKEINTRESOURCE(win.IDI_SHIELD)), true} }
func IconWinLogo() *Icon { return &Icon{win.LoadIcon(0, win.MAKEINTRESOURCE(win.IDI_WINLOGO)), true} }
func IconInformation() *Icon { return &Icon{win.LoadIcon(0, win.MAKEINTRESOURCE(win.IDI_INFORMATION)), true} }
func IconWarning() *Icon { return &Icon{win.LoadIcon(0, win.MAKEINTRESOURCE(win.IDI_WARNING)), true} }
func IconQuestion() *Icon { return &Icon{win.LoadIcon(0, win.MAKEINTRESOURCE(win.IDI_QUESTION)), true} }
func IconError() *Icon { return &Icon{win.LoadIcon(0, win.MAKEINTRESOURCE(win.IDI_ERROR)), true} }
func IconApplication() *Icon { return &Icon{win.LoadIcon(0, win.MAKEINTRESOURCE(win.IDI_APPLICATION)), true} }