func lastError(win32FuncName string) error { if errno := win.GetLastError(); errno != win.ERROR_SUCCESS { return newError(fmt.Sprintf("%s: Error %d", win32FuncName, errno)) } return newError(win32FuncName) }
func (fb *FormBase) SetOwner(value Form) error { fb.owner = value var ownerHWnd win.HWND if value != nil { ownerHWnd = value.Handle() } win.SetLastError(0) if 0 == win.SetWindowLong( fb.hWnd, win.GWL_HWNDPARENT, int32(ownerHWnd)) && win.GetLastError() != 0 { return lastError("SetWindowLong") } return nil }