Exemple #1
0
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
}
Exemple #2
0
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()
}
Exemple #3
0
func IconShield() *Icon {
	return &Icon{win.LoadIcon(0, win.MAKEINTRESOURCE(win.IDI_SHIELD)), true}
}
Exemple #4
0
func IconWinLogo() *Icon {
	return &Icon{win.LoadIcon(0, win.MAKEINTRESOURCE(win.IDI_WINLOGO)), true}
}
Exemple #5
0
func IconInformation() *Icon {
	return &Icon{win.LoadIcon(0, win.MAKEINTRESOURCE(win.IDI_INFORMATION)), true}
}
Exemple #6
0
func IconWarning() *Icon {
	return &Icon{win.LoadIcon(0, win.MAKEINTRESOURCE(win.IDI_WARNING)), true}
}
Exemple #7
0
func IconQuestion() *Icon {
	return &Icon{win.LoadIcon(0, win.MAKEINTRESOURCE(win.IDI_QUESTION)), true}
}
Exemple #8
0
func IconError() *Icon {
	return &Icon{win.LoadIcon(0, win.MAKEINTRESOURCE(win.IDI_ERROR)), true}
}
Exemple #9
0
func IconApplication() *Icon {
	return &Icon{win.LoadIcon(0, win.MAKEINTRESOURCE(win.IDI_APPLICATION)), true}
}