blob: fb78ed7a8b6b1d4e326977145fe46818970c6026 (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
|
// 7 february 2014
package ui
import (
"syscall"
"unsafe"
)
var (
user32 = syscall.NewLazyDLL("user32.dll")
kernel32 = syscall.NewLazyDLL("kernel32.dll")
gdi32 = syscall.NewLazyDLL("gdi32.dll")
comctl32 *syscall.LazyDLL // comctl32 not defined here; see comctl_windows.go
msimg32 = syscall.NewLazyDLL("msimg32.dll")
)
type _HANDLE uintptr
type _HWND _HANDLE
type _HBRUSH _HANDLE
type _HMENU _HANDLE
const (
_NULL = 0
_FALSE = 0 // from windef.h
_TRUE = 1 // from windef.h
)
// 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.)
type _WPARAM uintptr
type _LPARAM uintptr
type _LRESULT uintptr
func (w _WPARAM) LOWORD() uint16 {
// according to windef.h
return uint16(w & 0xFFFF)
}
func (w _WPARAM) HIWORD() uint16 {
// according to windef.h
return uint16((w >> 16) & 0xFFFF)
}
func _LPARAMFromString(str string) _LPARAM {
return _LPARAM(unsafe.Pointer(syscall.StringToUTF16Ptr(str)))
}
// microsoft's header files do this
func _MAKEINTRESOURCE(what uint16) uintptr {
return uintptr(what)
}
func (l _LPARAM) _X() int32 {
// according to windowsx.h
loword := uint16(l & 0xFFFF)
short := int16(loword) // convert to signed...
return int32(short) // ...and sign extend
}
func (l _LPARAM) _Y() int32 {
// according to windowsx.h
hiword := uint16((l & 0xFFFF0000) >> 16)
short := int16(hiword) // convert to signed...
return int32(short) // ...and sign extend
}
type _POINT struct {
X int32
Y int32
}
type _RECT struct {
Left int32
Top int32
Right int32
Bottom int32
}
// Predefined cursor resource IDs.
const (
_IDC_APPSTARTING = 32650
_IDC_ARROW = 32512
_IDC_CROSS = 32515
_IDC_HAND = 32649
_IDC_HELP = 32651
_IDC_IBEAM = 32513
// _IDC_ICON = 32641 // [Obsolete for applications marked version 4.0 or later.]
_IDC_NO = 32648
// _IDC_SIZE = 32640 // [Obsolete for applications marked version 4.0 or later. Use IDC_SIZEALL.]
_IDC_SIZEALL = 32646
_IDC_SIZENESW = 32643
_IDC_SIZENS = 32645
_IDC_SIZENWSE = 32642
_IDC_SIZEWE = 32644
_IDC_UPARROW = 32516
_IDC_WAIT = 32514
)
// Predefined icon resource IDs.
const (
_IDI_APPLICATION = 32512
_IDI_ASTERISK = 32516
_IDI_ERROR = 32513
_IDI_EXCLAMATION = 32515
_IDI_HAND = 32513
_IDI_INFORMATION = 32516
_IDI_QUESTION = 32514
_IDI_SHIELD = 32518
_IDI_WARNING = 32515
_IDI_WINLOGO = 32517
)
|