2014-02-07 20:17:24 -06:00
|
|
|
// 7 february 2014
|
|
|
|
package main
|
|
|
|
|
|
|
|
import (
|
|
|
|
"syscall"
|
2014-02-10 11:44:11 -06:00
|
|
|
"unsafe"
|
2014-02-07 20:17:24 -06:00
|
|
|
)
|
|
|
|
|
2014-02-10 15:00:11 -06:00
|
|
|
// TODO filter out commctrl.h stuff because the combobox and listbox stuff has values that differ between windows versions and bleh
|
|
|
|
// either that or switch to ComboBoxEx and ListView because they might not have that problem???
|
2014-02-10 11:44:11 -06:00
|
|
|
|
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-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-08 22:51:11 -06:00
|
|
|
// TODO pull the thanks for these three from the old wingo source
|
2014-02-10 04:00:24 -06:00
|
|
|
// TODO put these in windows.go
|
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
|
|
|
|
}
|