本文整理汇总了Golang中github.com/lxn/win.WINDOWPLACEMENT.Length方法的典型用法代码示例。如果您正苦于以下问题:Golang WINDOWPLACEMENT.Length方法的具体用法?Golang WINDOWPLACEMENT.Length怎么用?Golang WINDOWPLACEMENT.Length使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类github.com/lxn/win.WINDOWPLACEMENT
的用法示例。
在下文中一共展示了WINDOWPLACEMENT.Length方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Golang代码示例。
示例1: SaveState
func (fb *FormBase) SaveState() error {
if err := fb.clientComposite.SaveState(); err != nil {
return err
}
var wp win.WINDOWPLACEMENT
wp.Length = uint32(unsafe.Sizeof(wp))
if !win.GetWindowPlacement(fb.hWnd, &wp) {
return lastError("GetWindowPlacement")
}
state := fmt.Sprint(
wp.Flags, wp.ShowCmd,
wp.PtMinPosition.X, wp.PtMinPosition.Y,
wp.PtMaxPosition.X, wp.PtMaxPosition.Y,
wp.RcNormalPosition.Left, wp.RcNormalPosition.Top,
wp.RcNormalPosition.Right, wp.RcNormalPosition.Bottom)
if err := fb.putState(state); err != nil {
return err
}
return nil
}
示例2: RestoreState
func (fb *FormBase) RestoreState() error {
if fb.isInRestoreState {
return nil
}
fb.isInRestoreState = true
defer func() {
fb.isInRestoreState = false
}()
state, err := fb.getState()
if err != nil {
return err
}
if state == "" {
return nil
}
var wp win.WINDOWPLACEMENT
if _, err := fmt.Sscan(state,
&wp.Flags, &wp.ShowCmd,
&wp.PtMinPosition.X, &wp.PtMinPosition.Y,
&wp.PtMaxPosition.X, &wp.PtMaxPosition.Y,
&wp.RcNormalPosition.Left, &wp.RcNormalPosition.Top,
&wp.RcNormalPosition.Right, &wp.RcNormalPosition.Bottom); err != nil {
return err
}
wp.Length = uint32(unsafe.Sizeof(wp))
if !win.SetWindowPlacement(fb.hWnd, &wp) {
return lastError("SetWindowPlacement")
}
return fb.clientComposite.RestoreState()
}