2014-02-07 20:17:24 -06:00
// 7 february 2014
2014-02-19 10:41:10 -06:00
package ui
2014-02-07 20:17:24 -06:00
import (
"syscall"
2014-02-10 11:44:11 -06:00
"unsafe"
2014-02-07 20:17:24 -06:00
)
var (
user32 = syscall . NewLazyDLL ( "user32.dll" )
2014-02-08 22:51:11 -06:00
kernel32 = syscall . NewLazyDLL ( "kernel32.dll" )
2014-02-10 19:48:08 -06:00
gdi32 = syscall . NewLazyDLL ( "gdi32.dll" )
2014-02-25 07:28:10 -06:00
comctl32 = syscall . NewLazyDLL ( "comctl32.dll" )
2014-02-07 20:17:24 -06:00
)
2014-02-11 17:36:13 -06:00
type _HANDLE uintptr
type _HWND _HANDLE
type _HBRUSH _HANDLE
type _HMENU _HANDLE
2014-02-07 20:17:24 -06:00
const (
2014-02-11 17:36:13 -06:00
_NULL = 0
_FALSE = 0 // from windef.h
_TRUE = 1 // from windef.h
2014-02-07 20:17:24 -06:00
)
2014-02-15 14:41:50 -06:00
// In MSDN, _LPARAM and _LRESULT are listed as signed pointers, however their interpretation is message-specific. Ergo, just cast them yourself; it'll be the same. (Thanks to Tv` in #go-nuts for helping me realize this.)
2014-02-11 17:36:13 -06:00
type _WPARAM uintptr
type _LPARAM uintptr
type _LRESULT uintptr
2014-02-08 22:51:11 -06:00
2014-02-11 17:36:13 -06:00
func ( w _WPARAM ) LOWORD ( ) uint16 {
2014-02-10 03:59:39 -06:00
// according to windef.h
return uint16 ( w & 0xFFFF )
}
2014-02-11 17:36:13 -06:00
func ( w _WPARAM ) HIWORD ( ) uint16 {
2014-02-10 03:59:39 -06:00
// according to windef.h
return uint16 ( ( w >> 16 ) & 0xFFFF )
}
2014-02-11 17:36:13 -06:00
func _LPARAMFromString ( str string ) _LPARAM {
return _LPARAM ( unsafe . Pointer ( syscall . StringToUTF16Ptr ( str ) ) )
2014-02-10 11:44:11 -06:00
}
2014-02-08 22:51:11 -06:00
// microsoft's header files do this
2014-02-11 17:36:13 -06:00
func _MAKEINTRESOURCE ( what uint16 ) uintptr {
2014-02-08 22:51:11 -06:00
return uintptr ( what )
}
2014-02-10 11:44:11 -06:00
2014-02-11 17:36:13 -06:00
type _POINT struct {
X int32
Y int32
}
type _RECT struct {
Left int32
Top int32
Right int32
Bottom int32
}