diff --git a/init_windows.go b/init_windows.go index a4a0d7f..554fe23 100644 --- a/init_windows.go +++ b/init_windows.go @@ -8,24 +8,24 @@ import ( ) var ( - hInstance HANDLE + hInstance _HANDLE nCmdShow int // TODO font ) // TODO is this trick documented in MSDN? func getWinMainhInstance() (err error) { - r1, _, err := kernel32.NewProc("GetModuleHandleW").Call(uintptr(NULL)) + r1, _, err := kernel32.NewProc("GetModuleHandleW").Call(uintptr(_NULL)) if r1 == 0 { // failure return err } - hInstance = HANDLE(r1) + hInstance = _HANDLE(r1) return nil } -// TODO this is what MinGW-w64's crt (svn revision xxx) does; is it best? is any of this documented anywhere on MSDN? +// 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() (nCmdShow int, err error) { +func getWinMainnCmdShow() (err error) { var info struct { cb uint32 lpReserved *uint16 @@ -42,9 +42,9 @@ func getWinMainnCmdShow() (nCmdShow int, err error) { wShowWindow uint16 cbReserved2 uint16 lpReserved2 *byte - hStdInput HANDLE - hStdOutput HANDLE - hStdError HANDLE + hStdInput _HANDLE + hStdOutput _HANDLE + hStdError _HANDLE } const _STARTF_USESHOWWINDOW = 0x00000001 diff --git a/main_windows.go b/main_windows.go index 68000da..3fcbdd2 100644 --- a/main_windows.go +++ b/main_windows.go @@ -1,8 +1,8 @@ +// +build ignore + // 7 february 2014 package main -//+build skip - import ( "fmt" "os" diff --git a/unmigrated/menus_windows.go b/menus_windows.go similarity index 100% rename from unmigrated/menus_windows.go rename to menus_windows.go diff --git a/sysdata.go b/sysdata.go index 6f3c076..854e1a0 100644 --- a/sysdata.go +++ b/sysdata.go @@ -26,4 +26,5 @@ func (c *cSysData) hide() error { const ( c_window = iota c_button + nctypes ) diff --git a/sysdata_windows.go b/sysdata_windows.go index 42f438d..2aaace3 100644 --- a/sysdata_windows.go +++ b/sysdata_windows.go @@ -26,7 +26,7 @@ type classData struct { var classTypes = [nctypes]*classData{ c_window: &classData{ - name: uintptr(unsafe.Pointer(stdWndClass)), + name: uintptr(unsafe.Pointer(syscall.StringToUTF16Ptr(stdWndClass))), style: _WS_OVERLAPPEDWINDOW, xstyle: 0, }, @@ -57,7 +57,7 @@ func (s *sysData) make() (err error) { uintptr(hInstance), uintptr(_NULL), }, - ret: ret + ret: ret, } r := <-ret if r.err != nil { @@ -87,7 +87,7 @@ func (s *sysData) show() (err error) { defer close(ret) uitask <- &uimsg{ call: _showWindow, - p: []uintptr{uintptr(s.hwnd, show}, + p: []uintptr{uintptr(s.hwnd), show}, ret: ret, } r := <-ret diff --git a/sysdatacache_windows.go b/sysdatacache_windows.go index 1a45d97..46ce025 100644 --- a/sysdatacache_windows.go +++ b/sysdatacache_windows.go @@ -15,7 +15,7 @@ type sdcEntry struct { var ( sysDatas = map[_HWND]*sdcEntry{} - sysDatasLock sys.Mutex + sysDatasLock sync.Mutex ) func addSysData(hwnd _HWND, s *sysData) { diff --git a/windows_windows.go b/windows_windows.go index c1e08ed..a8eb169 100644 --- a/windows_windows.go +++ b/windows_windows.go @@ -2,7 +2,7 @@ package main import ( - "syscall" +// "syscall" "unsafe" ) @@ -173,27 +173,7 @@ var ( _showWindow = user32.NewProc("ShowWindow") ) -// TODO use lpParam -func CreateWindowEx(dwExStyle uint32, lpClassName string, lpWindowName string, dwStyle uint32, x int, y int, nWidth int, nHeight int, hwndParent HWND, hMenu HMENU, hInstance HANDLE, lpParam interface{}) (hwnd HWND, err error) { - r1, _, err := createWindowEx.Call( - uintptr(dwExStyle), - uintptr(unsafe.Pointer(syscall.StringToUTF16Ptr(lpClassName))), - uintptr(unsafe.Pointer(syscall.StringToUTF16Ptr(lpWindowName))), - uintptr(dwStyle), - uintptr(x), - uintptr(y), - uintptr(nWidth), - uintptr(nHeight), - uintptr(hwndParent), - uintptr(hMenu), - uintptr(hInstance), - uintptr(0)) - if r1 == 0 { // failure - return NULL, err - } - return HWND(r1), nil -} - +/* func DestroyWindow(hWnd HWND) (err error) { r1, _, err := destroyWindow.Call(uintptr(hWnd)) if r1 == 0 { // failure @@ -249,14 +229,7 @@ func SetWindowPos(hWnd HWND, hWndInsertAfter HWND, X int, Y int, cx int, cy int, } return nil } - -// TODO figure out how to handle errors -func ShowWindow(hWnd HWND, nCmdShow int) (previouslyVisible bool, err error) { - r1, _, _ := showWindow.Call( - uintptr(hWnd), - uintptr(nCmdShow)) - return r1 != 0, nil -} +*/ // WM_SETICON and WM_GETICON values. const ( @@ -377,6 +350,6 @@ type _MINMAXINFO struct { PtMaxTrackSize _POINT } -func (l _LPARAM) MINMAXINFO() *MINMAXINFO { +func (l _LPARAM) MINMAXINFO() *_MINMAXINFO { return (*_MINMAXINFO)(unsafe.Pointer(l)) }