Exemplo n.º 1
0
Arquivo: ngui.go Projeto: CodyGuo/ngui
func MustRegisterTransparentWindowClass(className string) {
	hInstance := win.GetModuleHandle(nil)
	if hInstance == 0 {
		panic("GetModuleHandle")
	}
	fmt.Printf("MustRegisterTransparentWindowClass hInstance=%v\n", hInstance)
	//hIcon := win.LoadIcon(hInstance, (*uint16)(unsafe.Pointer(uintptr(win.IDI_APPLICATION))))
	hIcon, _ := NewIconFromResource(hInstance, ICON_MAIN)
	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 = transparentWndProc
	wc.HInstance = hInstance
	wc.HIcon = hIcon
	wc.HCursor = hCursor
	wc.HbrBackground = win.BS_SOLID //win.BS_SOLID//win.COLOR_WINDOW + 1 //COLOR_BTNFACE
	wc.LpszClassName = syscall.StringToUTF16Ptr(className)

	if atom := win.RegisterClassEx(&wc); atom == 0 {
		panic("RegisterClassEx")
	}
}
Exemplo n.º 2
0
Arquivo: it.go Projeto: CodyGuo/gowi
func init() {
	hInst := win.GetModuleHandle(nil)
	if hInst == 0 {
		panic("GetModuleHandle")
	}
	gWindowRegistry = make(map[win.HWND]Window)
}
Exemplo n.º 3
0
Arquivo: main.go Projeto: CodyGuo/gapp
func init() {
	hInstance := win.GetModuleHandle(nil)
	if hInstance == 0 {
		panic("GetModuleHandle")
	}

	MustRegisterWindowClass(nguiWindowClass)

	windowHolders = make(map[string]win.HWND)

	manifest.Load()
}
Exemplo n.º 4
0
Arquivo: icon.go Projeto: CodyGuo/gowi
// 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 = errors.New("GetModuleHandle")
		return
	}
	if hIcon := win.LoadIcon(hInst, syscall.StringToUTF16Ptr(resName)); hIcon == 0 {
		err = errors.New("LoadIcon")
	} else {
		ic = &Icon{hIcon: hIcon}
	}
	return
}
Exemplo n.º 5
0
Arquivo: ngui.go Projeto: CodyGuo/ngui
func init() {
	hInstance := win.GetModuleHandle(nil)
	if hInstance == 0 {
		panic("GetModuleHandle")
	}
}