summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorPietro Gagliardi <[email protected]>2014-02-15 14:11:54 -0500
committerPietro Gagliardi <[email protected]>2014-02-15 14:11:54 -0500
commit355016de05c3634f356d52de6720aad32549cb5c (patch)
tree4efd86e6139edafb2aec5e1f88376c528ef87d76
parentc67191094f80c7b80de36d91f22bb3e69cb4a6a3 (diff)
More error/TODO reduction.
-rw-r--r--init_windows.go13
-rw-r--r--uitask_windows.go2
-rw-r--r--winerrors.md2
3 files changed, 6 insertions, 11 deletions
diff --git a/init_windows.go b/init_windows.go
index 753ba8e..0036047 100644
--- a/init_windows.go
+++ b/init_windows.go
@@ -24,8 +24,7 @@ func getWinMainhInstance() (err error) {
}
// TODO this is what MinGW-w64's crt (svn revision TODO) does; is it best? is any of this documented anywhere on MSDN?
-// TODO I highly doubt Windows API functions ever not fail, so figure out what to do should an error actually occur
-func getWinMainnCmdShow() (err error) {
+func getWinMainnCmdShow() {
var info struct {
cb uint32
lpReserved *uint16
@@ -52,10 +51,9 @@ func getWinMainnCmdShow() (err error) {
kernel32.NewProc("GetStartupInfoW").Call(uintptr(unsafe.Pointer(&info)))
if info.dwFlags & _STARTF_USESHOWWINDOW != 0 {
nCmdShow = int(info.wShowWindow)
- return nil
+ } else {
+ nCmdShow = _SW_SHOWDEFAULT
}
- nCmdShow = _SW_SHOWDEFAULT
- return nil
}
func doWindowsInit() (err error) {
@@ -63,10 +61,7 @@ func doWindowsInit() (err error) {
if err != nil {
return fmt.Errorf("error getting WinMain hInstance: %v", err)
}
- err = getWinMainnCmdShow()
- if err != nil {
- return fmt.Errorf("error getting WinMain nCmdShow: %v", err)
- }
+ getWinMainnCmdShow()
err = initWndClassInfo()
if err != nil {
return fmt.Errorf("error initializing standard window class auxiliary info: %v", err)
diff --git a/uitask_windows.go b/uitask_windows.go
index 9953ac4..9685133 100644
--- a/uitask_windows.go
+++ b/uitask_windows.go
@@ -67,7 +67,6 @@ func msgloopstep() (quit bool) {
Pt _POINT
}
- // TODO figure out how to handle errors
r1, _, _ := _peekMessage.Call(
uintptr(unsafe.Pointer(&msg)),
uintptr(_NULL),
@@ -80,7 +79,6 @@ func msgloopstep() (quit bool) {
if msg.Message == _WM_QUIT {
return true
}
- // TODO handle potential errors in TranslateMessage() and DispatchMessage()
_translateMessage.Call(uintptr(unsafe.Pointer(&msg)))
_dispatchMessage.Call(uintptr(unsafe.Pointer(&msg)))
return false
diff --git a/winerrors.md b/winerrors.md
index 542b527..fd401ca 100644
--- a/winerrors.md
+++ b/winerrors.md
@@ -5,3 +5,5 @@
- CB_GETCURSEL/LB_GETCURSEL (sysData.selectedIndex())
- LB_GETSELCOUNT/LB_GETSELITEMS (LB_ERR is returned if this is a single-selection listbox; are there actual errors?) (sysData.selectedIndices())
- LB_GETTEXTLEN/LB_GETTEXT (LB_ERR is returned if the given index is invalid, but since we get indices from LB_GETSELITEMS this shouldn't happen; are there actual errors?) (sysData.selectedTexts())
+- PeekMessage(), TranslateMessage(), DispatchMessage() (the first one is odd as GetMessage() can return an error but PeekMessage() doesn't?) (msgloopstep())
+- GetStartupInfoW() (MSDN explicitly says this function does not fail... oh really? well I suppose it cannot fail since it returns something all processes must have to begin with) (getWinMainnCmdShow())