diff options
| author | Pietro Gagliardi <[email protected]> | 2014-06-12 09:51:29 -0400 |
|---|---|---|
| committer | Pietro Gagliardi <[email protected]> | 2014-06-12 09:51:29 -0400 |
| commit | 29e5384b2e2c1aa8a3feb713c01b187b6c4c6bb7 (patch) | |
| tree | 0f2d7a9d74d68e7057a19dc109ef1c5ed8487f7d | |
| parent | fc18ecc3d8076ce353769dcfbf15a8a4b1600656 (diff) | |
Migrated dialog_windows.go to use func() for uitask.
| -rw-r--r-- | dialog_windows.go | 18 |
1 files changed, 7 insertions, 11 deletions
diff --git a/dialog_windows.go b/dialog_windows.go index c6da94b..45a2a73 100644 --- a/dialog_windows.go +++ b/dialog_windows.go @@ -30,21 +30,17 @@ func _msgBox(parent *Window, primarytext string, secondarytext string, uType uin go func() { ret := make(chan uiret) defer close(ret) - uitask <- &uimsg{ - call: _messageBox, - p: []uintptr{ + uitask <- func() { + r1, _, err := _messageBox.Call( uintptr(parenthwnd), utf16ToArg(ptext), utf16ToArg(ptitle), - uintptr(uType), - }, - ret: ret, + uintptr(uType)) + if r1 == 0 { // failure + panic(fmt.Sprintf("error displaying message box to user: %v\nstyle: 0x%08X\ntitle: %q\ntext:\n%s", err, uType, os.Args[0], text)) + } + retchan <- int(r1) } - r := <-ret - if r.ret == 0 { // failure - panic(fmt.Sprintf("error displaying message box to user: %v\nstyle: 0x%08X\ntitle: %q\ntext:\n%s", r.err, uType, os.Args[0], text)) - } - retchan <- int(r.ret) }() return retchan } |
