diff options
Diffstat (limited to 'common_windows.go')
| -rw-r--r-- | common_windows.go | 10 |
1 files changed, 5 insertions, 5 deletions
diff --git a/common_windows.go b/common_windows.go index d7f8eaf..7a12a8a 100644 --- a/common_windows.go +++ b/common_windows.go @@ -4,9 +4,9 @@ package ui import ( "fmt" + "reflect" "syscall" "unsafe" - "reflect" ) // #include "winapi_windows.h" @@ -40,7 +40,7 @@ func getWindowText(hwnd C.HWND) string { // WM_GETTEXTLENGTH and WM_GETTEXT return the count /without/ the terminating null character // but WM_GETTEXT expects the buffer size handed to it to /include/ the terminating null character n := C.getWindowTextLen(hwnd) - buf := make([]uint16, int(n + 1)) + buf := make([]uint16, int(n+1)) C.getWindowText(hwnd, C.WPARAM(n), C.LPWSTR(unsafe.Pointer(&buf[0]))) return syscall.UTF16ToString(buf) @@ -49,9 +49,9 @@ func getWindowText(hwnd C.HWND) string { func wstrToString(wstr *C.WCHAR) string { n := C.wcslen((*C.wchar_t)(unsafe.Pointer(wstr))) xbuf := &reflect.SliceHeader{ - Data: uintptr(unsafe.Pointer(wstr)), - Len: int(n + 1), - Cap: int(n + 1), + Data: uintptr(unsafe.Pointer(wstr)), + Len: int(n + 1), + Cap: int(n + 1), } buf := (*[]uint16)(unsafe.Pointer(xbuf)) return syscall.UTF16ToString(*buf) |
