@@ -17,8 +17,10 @@ import (
17
17
"unsafe"
18
18
)
19
19
20
- type Handle uintptr
21
- type HWND uintptr
20
+ type (
21
+ Handle uintptr
22
+ HWND uintptr
23
+ )
22
24
23
25
const (
24
26
InvalidHandle = ^ Handle (0 )
@@ -211,6 +213,8 @@ func NewCallbackCDecl(fn interface{}) uintptr {
211
213
//sys OpenProcess(desiredAccess uint32, inheritHandle bool, processId uint32) (handle Handle, err error)
212
214
//sys ShellExecute(hwnd Handle, verb *uint16, file *uint16, args *uint16, cwd *uint16, showCmd int32) (err error) [failretval<=32] = shell32.ShellExecuteW
213
215
//sys GetWindowThreadProcessId(hwnd HWND, pid *uint32) (tid uint32, err error) = user32.GetWindowThreadProcessId
216
+ //sys GetKeyboardLayout(tid uint32) (hkl Handle) = user32.GetKeyboardLayout
217
+ //sys toUnicodeEx(vkey uint32, scancode uint32, keystate *byte, pwszBuff *uint16, cchBuff int32, flags uint32, hkl Handle) (ret int32) = user32.ToUnicodeEx
214
218
//sys GetShellWindow() (shellWindow HWND) = user32.GetShellWindow
215
219
//sys MessageBox(hwnd HWND, text *uint16, caption *uint16, boxtype uint32) (ret int32, err error) [failretval==0] = user32.MessageBoxW
216
220
//sys ExitWindowsEx(flags uint32, reason uint32) (err error) = user32.ExitWindowsEx
@@ -1368,9 +1372,11 @@ func SetsockoptLinger(fd Handle, level, opt int, l *Linger) (err error) {
1368
1372
func SetsockoptInet4Addr (fd Handle , level , opt int , value [4 ]byte ) (err error ) {
1369
1373
return Setsockopt (fd , int32 (level ), int32 (opt ), (* byte )(unsafe .Pointer (& value [0 ])), 4 )
1370
1374
}
1375
+
1371
1376
func SetsockoptIPMreq (fd Handle , level , opt int , mreq * IPMreq ) (err error ) {
1372
1377
return Setsockopt (fd , int32 (level ), int32 (opt ), (* byte )(unsafe .Pointer (mreq )), int32 (unsafe .Sizeof (* mreq )))
1373
1378
}
1379
+
1374
1380
func SetsockoptIPv6Mreq (fd Handle , level , opt int , mreq * IPv6Mreq ) (err error ) {
1375
1381
return syscall .EWINDOWS
1376
1382
}
@@ -1916,3 +1922,13 @@ const (
1916
1922
EV_ERR = 0x0080
1917
1923
EV_RING = 0x0100
1918
1924
)
1925
+
1926
+ // ToUnicodeEx Translates the specified virtual-key code and keyboard state to
1927
+ // the corresponding Unicode character or characters.
1928
+ func ToUnicodeEx (virtualKey , scanCode uint32 , buf []uint16 , flags uint32 , layout Handle ) int32 {
1929
+ if len (buf ) == 0 {
1930
+ return 0
1931
+ }
1932
+ var keyState [256 ]byte
1933
+ return toUnicodeEx (virtualKey , scanCode , & keyState [0 ], & buf [0 ], int32 (len (buf )), flags , layout )
1934
+ }
0 commit comments