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") } }
func init() { hInst := win.GetModuleHandle(nil) if hInst == 0 { panic("GetModuleHandle") } gWindowRegistry = make(map[win.HWND]Window) }
func init() { hInstance := win.GetModuleHandle(nil) if hInstance == 0 { panic("GetModuleHandle") } MustRegisterWindowClass(nguiWindowClass) windowHolders = make(map[string]win.HWND) manifest.Load() }
// 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 }
func init() { hInstance := win.GetModuleHandle(nil) if hInstance == 0 { panic("GetModuleHandle") } }