當前位置: 首頁>>代碼示例>>Golang>>正文


Golang win.LoadIcon函數代碼示例

本文整理匯總了Golang中github.com/lxn/win.LoadIcon函數的典型用法代碼示例。如果您正苦於以下問題:Golang LoadIcon函數的具體用法?Golang LoadIcon怎麽用?Golang LoadIcon使用的例子?那麽, 這裏精選的函數代碼示例或許可以為您提供幫助。


在下文中一共展示了LoadIcon函數的11個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的Golang代碼示例。

示例1: MustRegisterWindowClassWithWndProcPtr

func MustRegisterWindowClassWithWndProcPtr(className string, wndProcPtr uintptr) {
	if registeredWindowClasses[className] {
		panic("window class already registered")
	}

	hInst := win.GetModuleHandle(nil)
	if hInst == 0 {
		panic("GetModuleHandle")
	}

	hIcon := win.LoadIcon(0, (*uint16)(unsafe.Pointer(uintptr(win.IDI_APPLICATION))))
	if hIcon == 0 {
		panic("LoadIcon")
	}

	hCursor := win.LoadCursor(0, (*uint16)(unsafe.Pointer(uintptr(win.IDC_ARROW))))
	if hCursor == 0 {
		panic("LoadCursor")
	}

	var wc win.WNDCLASSEX
	wc.CbSize = uint32(unsafe.Sizeof(wc))
	wc.LpfnWndProc = wndProcPtr
	wc.HInstance = hInst
	wc.HIcon = hIcon
	wc.HCursor = hCursor
	wc.HbrBackground = win.COLOR_BTNFACE + 1
	wc.LpszClassName = syscall.StringToUTF16Ptr(className)

	if atom := win.RegisterClassEx(&wc); atom == 0 {
		panic("RegisterClassEx")
	}

	registeredWindowClasses[className] = true
}
開發者ID:henrylee2cn,項目名稱:walk,代碼行數:35,代碼來源:window.go

示例2: MyRegisterClass

func MyRegisterClass(hInstance win.HINSTANCE) (atom win.ATOM) {
	var wc win.WNDCLASSEX
	wc.CbSize = uint32(unsafe.Sizeof(wc))
	wc.Style = win.CS_HREDRAW | win.CS_VREDRAW
	wc.LpfnWndProc = syscall.NewCallback(WndProc)
	wc.CbClsExtra = 0
	wc.CbWndExtra = 0
	wc.HInstance = hInstance
	wc.HbrBackground = win.GetSysColorBrush(win.COLOR_WINDOWFRAME)
	wc.LpszMenuName = syscall.StringToUTF16Ptr("")
	wc.LpszClassName = syscall.StringToUTF16Ptr(wndClassName)
	wc.HIconSm = win.LoadIcon(0, win.MAKEINTRESOURCE(win.IDI_APPLICATION))
	wc.HIcon = win.LoadIcon(0, win.MAKEINTRESOURCE(win.IDI_APPLICATION))
	wc.HCursor = win.LoadCursor(0, win.MAKEINTRESOURCE(win.IDC_ARROW))

	return win.RegisterClassEx(&wc)
}
開發者ID:Archs,項目名稱:go-htmlayout,代碼行數:17,代碼來源:main4.go

示例3: NewIconFromResource

// NewIconFromResource returns a new Icon, using the specified icon resource.
func NewIconFromResource(resName string) (ic *Icon, err error) {
	hInst := win.GetModuleHandle(nil)
	if hInst == 0 {
		err = lastError("GetModuleHandle")
		return
	}
	if hIcon := win.LoadIcon(hInst, syscall.StringToUTF16Ptr(resName)); hIcon == 0 {
		err = lastError("LoadIcon")
	} else {
		ic = &Icon{hIcon: hIcon}
	}
	return
}
開發者ID:2105666566,項目名稱:walk,代碼行數:14,代碼來源:icon.go

示例4: NewIconFromResourceId

func NewIconFromResourceId(id uintptr) (*Icon, error) {
	hInst := win.GetModuleHandle(nil)
	if hInst == 0 {
		return nil, lastError("GetModuleHandle")
	}

	hIcon := win.LoadIcon(hInst, win.MAKEINTRESOURCE(id))
	if hIcon == 0 {
		return nil, lastError("LoadIcon")
	}

	return &Icon{hIcon: hIcon}, nil
}
開發者ID:Archs,項目名稱:walk,代碼行數:13,代碼來源:icon.go

示例5: IconShield

func IconShield() *Icon {
	return &Icon{win.LoadIcon(0, win.MAKEINTRESOURCE(win.IDI_SHIELD)), true}
}
開發者ID:2105666566,項目名稱:walk,代碼行數:3,代碼來源:icon.go

示例6: IconWinLogo

func IconWinLogo() *Icon {
	return &Icon{win.LoadIcon(0, win.MAKEINTRESOURCE(win.IDI_WINLOGO)), true}
}
開發者ID:2105666566,項目名稱:walk,代碼行數:3,代碼來源:icon.go

示例7: IconInformation

func IconInformation() *Icon {
	return &Icon{win.LoadIcon(0, win.MAKEINTRESOURCE(win.IDI_INFORMATION)), true}
}
開發者ID:2105666566,項目名稱:walk,代碼行數:3,代碼來源:icon.go

示例8: IconWarning

func IconWarning() *Icon {
	return &Icon{win.LoadIcon(0, win.MAKEINTRESOURCE(win.IDI_WARNING)), true}
}
開發者ID:2105666566,項目名稱:walk,代碼行數:3,代碼來源:icon.go

示例9: IconQuestion

func IconQuestion() *Icon {
	return &Icon{win.LoadIcon(0, win.MAKEINTRESOURCE(win.IDI_QUESTION)), true}
}
開發者ID:2105666566,項目名稱:walk,代碼行數:3,代碼來源:icon.go

示例10: IconError

func IconError() *Icon {
	return &Icon{win.LoadIcon(0, win.MAKEINTRESOURCE(win.IDI_ERROR)), true}
}
開發者ID:2105666566,項目名稱:walk,代碼行數:3,代碼來源:icon.go

示例11: IconApplication

func IconApplication() *Icon {
	return &Icon{win.LoadIcon(0, win.MAKEINTRESOURCE(win.IDI_APPLICATION)), true}
}
開發者ID:2105666566,項目名稱:walk,代碼行數:3,代碼來源:icon.go


注:本文中的github.com/lxn/win.LoadIcon函數示例由純淨天空整理自Github/MSDocs等開源代碼及文檔管理平台,相關代碼片段篩選自各路編程大神貢獻的開源項目,源碼版權歸原作者所有,傳播和使用請參考對應項目的License;未經允許,請勿轉載。