示例#1
0
func registerClasses() error {
	var wc w32.WNDCLASSEX
	wc = w32.WNDCLASSEX{
		/* Size */ uint32(unsafe.Sizeof(wc)),
		/* Style */ w32.CS_HREDRAW | w32.CS_VREDRAW,
		/* WndProc */ syscall.NewCallback(wndProc),
		/* ClsExtra */ 0,
		/* WndExtra */ 0,
		/* Instance */ appHandle,
		/* Icon */ 0,
		/* Cursor */ w32.LoadCursor(0, w32.MakeIntResource(w32.IDC_ARROW)),
		/* Background*/ w32.HBRUSH(w32.COLOR_WINDOW),
		/* MenuName */ nil,
		/* ClassName */ wndClassName,
		/* IconSm */ 0,
	}

	if res := w32.RegisterClassEx(&wc); res == 0 {
		return errors.New("Failed to register window class!")
	}

	return nil
}
示例#2
0
func LoadIcon(id uint16) Icon {
	return Icon(w32.LoadIcon(appHandle, w32.MakeIntResource(id)))
}