本文整理汇总了Golang中github.com/lxn/win.SetLastError函数的典型用法代码示例。如果您正苦于以下问题:Golang SetLastError函数的具体用法?Golang SetLastError怎么用?Golang SetLastError使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。
在下文中一共展示了SetLastError函数的5个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的Golang代码示例。
示例1: setAndClearStyleBits
func (wb *WindowBase) setAndClearStyleBits(set, clear uint32) error {
style := uint32(win.GetWindowLong(wb.hWnd, win.GWL_STYLE))
if style == 0 {
return lastError("GetWindowLong")
}
if newStyle := style&^clear | set; newStyle != style {
win.SetLastError(0)
if win.SetWindowLong(wb.hWnd, win.GWL_STYLE, int32(newStyle)) == 0 {
return lastError("SetWindowLong")
}
}
return nil
}
开发者ID:henrylee2cn,项目名称:walk,代码行数:15,代码来源:window.go
示例2: SetOwner
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
}
开发者ID:2105666566,项目名称:walk,代码行数:19,代码来源:form.go
示例3: removePage
func (tw *TabWidget) removePage(page *TabPage) (err error) {
page.SetVisible(false)
style := uint32(win.GetWindowLong(page.hWnd, win.GWL_STYLE))
if style == 0 {
return lastError("GetWindowLong")
}
style &^= win.WS_CHILD
style |= win.WS_POPUP
win.SetLastError(0)
if win.SetWindowLong(page.hWnd, win.GWL_STYLE, int32(style)) == 0 {
return lastError("SetWindowLong")
}
page.tabWidget = nil
return page.SetParent(nil)
}
开发者ID:Ryanker,项目名称:walk,代码行数:20,代码来源:tabwidget.go
示例4: onInsertedPage
func (tw *TabWidget) onInsertedPage(index int, page *TabPage) (err error) {
item := tw.tcitemFromPage(page)
if idx := int(win.SendMessage(tw.hWndTab, win.TCM_INSERTITEM, uintptr(index), uintptr(unsafe.Pointer(item)))); idx == -1 {
return newError("SendMessage(TCM_INSERTITEM) failed")
}
page.SetVisible(false)
style := uint32(win.GetWindowLong(page.hWnd, win.GWL_STYLE))
if style == 0 {
return lastError("GetWindowLong")
}
style |= win.WS_CHILD
style &^= win.WS_POPUP
win.SetLastError(0)
if win.SetWindowLong(page.hWnd, win.GWL_STYLE, int32(style)) == 0 {
return lastError("SetWindowLong")
}
if win.SetParent(page.hWnd, tw.hWnd) == 0 {
return lastError("SetParent")
}
if tw.pages.Len() == 1 {
page.SetVisible(true)
tw.SetCurrentIndex(0)
}
tw.resizePages()
page.tabWidget = tw
page.applyFont(tw.Font())
return
}
开发者ID:Ryanker,项目名称:walk,代码行数:39,代码来源:tabwidget.go
示例5: SetParent
// SetParent sets the parent of the WidgetBase and adds the WidgetBase to the
// Children list of the Container.
func (wb *WidgetBase) SetParent(parent Container) (err error) {
if parent == wb.parent {
return nil
}
style := uint32(win.GetWindowLong(wb.hWnd, win.GWL_STYLE))
if style == 0 {
return lastError("GetWindowLong")
}
if parent == nil {
style &^= win.WS_CHILD
style |= win.WS_POPUP
if win.SetParent(wb.hWnd, 0) == 0 {
return lastError("SetParent")
}
win.SetLastError(0)
if win.SetWindowLong(wb.hWnd, win.GWL_STYLE, int32(style)) == 0 {
return lastError("SetWindowLong")
}
} else {
style |= win.WS_CHILD
style &^= win.WS_POPUP
win.SetLastError(0)
if win.SetWindowLong(wb.hWnd, win.GWL_STYLE, int32(style)) == 0 {
return lastError("SetWindowLong")
}
if win.SetParent(wb.hWnd, parent.Handle()) == 0 {
return lastError("SetParent")
}
}
b := wb.Bounds()
if !win.SetWindowPos(
wb.hWnd,
win.HWND_BOTTOM,
int32(b.X),
int32(b.Y),
int32(b.Width),
int32(b.Height),
win.SWP_FRAMECHANGED) {
return lastError("SetWindowPos")
}
oldParent := wb.parent
wb.parent = parent
var oldChildren, newChildren *WidgetList
if oldParent != nil {
oldChildren = oldParent.Children()
}
if parent != nil {
newChildren = parent.Children()
}
if newChildren == oldChildren {
return nil
}
widget := wb.window.(Widget)
if oldChildren != nil {
oldChildren.Remove(widget)
}
if newChildren != nil && !newChildren.containsHandle(wb.hWnd) {
newChildren.Add(widget)
}
return nil
}
开发者ID:Archs,项目名称:walk,代码行数:78,代码来源:widget.go
注:本文中的github.com/lxn/win.SetLastError函数示例整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。 |
请发表评论