Example #1
0
func newWindow(title string, width int, height int, control Control) *window {
	w := &window{
		closing: newEvent(),
		child:   control,
	}
	w.hwnd = C.newWindow(toUTF16(title), C.int(width), C.int(height), unsafe.Pointer(w))
	hresult := C.EnableThemeDialogTexture(w.hwnd, C.ETDT_ENABLE|C.ETDT_USETABTEXTURE)
	if hresult != C.S_OK {
		panic(fmt.Errorf("error setting tab background texture on Window; HRESULT: 0x%X", hresult))
	}
	w.child.setParent(&controlParent{w.hwnd})
	return w
}
Example #2
0
func newWindow(title string, width int, height int, control Control) *window {
	w := &window{
		// hwnd set in WM_CREATE handler
		closing:   newEvent(),
		container: newContainer(control),
	}
	hwnd := C.newWindow(toUTF16(title), C.int(width), C.int(height), unsafe.Pointer(w))
	if hwnd != w.hwnd {
		panic(fmt.Errorf("inconsistency: hwnd returned by CreateWindowEx() (%p) and hwnd stored in Window (%p) differ", hwnd, w.hwnd))
	}
	hresult := C.EnableThemeDialogTexture(w.hwnd, C.ETDT_ENABLE|C.ETDT_USETABTEXTURE)
	if hresult != C.S_OK {
		panic(fmt.Errorf("error setting tab background texture on Window; HRESULT: 0x%X", hresult))
	}
	w.container.setParent(w.hwnd)
	return w
}