2012-04-19 14:49:55 +00:00
|
|
|
// +build windows
|
|
|
|
// mksyscall_windows.pl winapi.go
|
|
|
|
// MACHINE GENERATED BY THE COMMAND ABOVE; DO NOT EDIT
|
|
|
|
|
2011-04-27 08:06:14 +00:00
|
|
|
package wingui
|
|
|
|
|
|
|
|
import "unsafe"
|
|
|
|
import "syscall"
|
|
|
|
|
|
|
|
var (
|
2012-04-19 14:49:55 +00:00
|
|
|
modkernel32 = syscall.NewLazyDLL("kernel32.dll")
|
|
|
|
moduser32 = syscall.NewLazyDLL("user32.dll")
|
|
|
|
|
|
|
|
procGetModuleHandleW = modkernel32.NewProc("GetModuleHandleW")
|
|
|
|
procRegisterClassExW = moduser32.NewProc("RegisterClassExW")
|
|
|
|
procCreateWindowExW = moduser32.NewProc("CreateWindowExW")
|
|
|
|
procDefWindowProcW = moduser32.NewProc("DefWindowProcW")
|
|
|
|
procDestroyWindow = moduser32.NewProc("DestroyWindow")
|
|
|
|
procPostQuitMessage = moduser32.NewProc("PostQuitMessage")
|
|
|
|
procShowWindow = moduser32.NewProc("ShowWindow")
|
|
|
|
procUpdateWindow = moduser32.NewProc("UpdateWindow")
|
|
|
|
procGetMessageW = moduser32.NewProc("GetMessageW")
|
|
|
|
procTranslateMessage = moduser32.NewProc("TranslateMessage")
|
|
|
|
procDispatchMessageW = moduser32.NewProc("DispatchMessageW")
|
|
|
|
procLoadIconW = moduser32.NewProc("LoadIconW")
|
|
|
|
procLoadCursorW = moduser32.NewProc("LoadCursorW")
|
|
|
|
procSetCursor = moduser32.NewProc("SetCursor")
|
|
|
|
procSendMessageW = moduser32.NewProc("SendMessageW")
|
|
|
|
procPostMessageW = moduser32.NewProc("PostMessageW")
|
2011-04-27 08:06:14 +00:00
|
|
|
)
|
|
|
|
|
2012-04-19 14:49:55 +00:00
|
|
|
func GetModuleHandle(modname *uint16) (handle syscall.Handle, err error) {
|
|
|
|
r0, _, e1 := syscall.Syscall(procGetModuleHandleW.Addr(), 1, uintptr(unsafe.Pointer(modname)), 0, 0)
|
|
|
|
handle = syscall.Handle(r0)
|
|
|
|
if handle == 0 {
|
|
|
|
if e1 != 0 {
|
|
|
|
err = error(e1)
|
|
|
|
} else {
|
|
|
|
err = syscall.EINVAL
|
|
|
|
}
|
|
|
|
}
|
|
|
|
return
|
|
|
|
}
|
|
|
|
|
|
|
|
func RegisterClassEx(wndclass *Wndclassex) (atom uint16, err error) {
|
|
|
|
r0, _, e1 := syscall.Syscall(procRegisterClassExW.Addr(), 1, uintptr(unsafe.Pointer(wndclass)), 0, 0)
|
|
|
|
atom = uint16(r0)
|
|
|
|
if atom == 0 {
|
|
|
|
if e1 != 0 {
|
|
|
|
err = error(e1)
|
|
|
|
} else {
|
|
|
|
err = syscall.EINVAL
|
|
|
|
}
|
|
|
|
}
|
|
|
|
return
|
|
|
|
}
|
|
|
|
|
|
|
|
func CreateWindowEx(exstyle uint32, classname *uint16, windowname *uint16, style uint32, x int32, y int32, width int32, height int32, wndparent syscall.Handle, menu syscall.Handle, instance syscall.Handle, param uintptr) (hwnd syscall.Handle, err error) {
|
|
|
|
r0, _, e1 := syscall.Syscall12(procCreateWindowExW.Addr(), 12, uintptr(exstyle), uintptr(unsafe.Pointer(classname)), uintptr(unsafe.Pointer(windowname)), uintptr(style), uintptr(x), uintptr(y), uintptr(width), uintptr(height), uintptr(wndparent), uintptr(menu), uintptr(instance), uintptr(param))
|
|
|
|
hwnd = syscall.Handle(r0)
|
|
|
|
if hwnd == 0 {
|
|
|
|
if e1 != 0 {
|
|
|
|
err = error(e1)
|
|
|
|
} else {
|
|
|
|
err = syscall.EINVAL
|
|
|
|
}
|
|
|
|
}
|
|
|
|
return
|
|
|
|
}
|
|
|
|
|
|
|
|
func DefWindowProc(hwnd syscall.Handle, msg uint32, wparam uintptr, lparam uintptr) (lresult uintptr) {
|
|
|
|
r0, _, _ := syscall.Syscall6(procDefWindowProcW.Addr(), 4, uintptr(hwnd), uintptr(msg), uintptr(wparam), uintptr(lparam), 0, 0)
|
|
|
|
lresult = uintptr(r0)
|
|
|
|
return
|
|
|
|
}
|
|
|
|
|
|
|
|
func DestroyWindow(hwnd syscall.Handle) (err error) {
|
|
|
|
r1, _, e1 := syscall.Syscall(procDestroyWindow.Addr(), 1, uintptr(hwnd), 0, 0)
|
|
|
|
if int(r1) == 0 {
|
|
|
|
if e1 != 0 {
|
|
|
|
err = error(e1)
|
|
|
|
} else {
|
|
|
|
err = syscall.EINVAL
|
|
|
|
}
|
|
|
|
}
|
|
|
|
return
|
2011-04-27 08:06:14 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
func PostQuitMessage(exitcode int32) {
|
2012-04-19 14:49:55 +00:00
|
|
|
syscall.Syscall(procPostQuitMessage.Addr(), 1, uintptr(exitcode), 0, 0)
|
|
|
|
return
|
2011-04-27 08:06:14 +00:00
|
|
|
}
|
|
|
|
|
2012-04-19 14:49:55 +00:00
|
|
|
func ShowWindow(hwnd syscall.Handle, cmdshow int32) (wasvisible bool) {
|
|
|
|
r0, _, _ := syscall.Syscall(procShowWindow.Addr(), 2, uintptr(hwnd), uintptr(cmdshow), 0)
|
|
|
|
wasvisible = bool(r0 != 0)
|
|
|
|
return
|
2011-04-27 08:06:14 +00:00
|
|
|
}
|
|
|
|
|
2012-04-19 14:49:55 +00:00
|
|
|
func UpdateWindow(hwnd syscall.Handle) (err error) {
|
|
|
|
r1, _, e1 := syscall.Syscall(procUpdateWindow.Addr(), 1, uintptr(hwnd), 0, 0)
|
|
|
|
if int(r1) == 0 {
|
|
|
|
if e1 != 0 {
|
|
|
|
err = error(e1)
|
|
|
|
} else {
|
|
|
|
err = syscall.EINVAL
|
|
|
|
}
|
|
|
|
}
|
|
|
|
return
|
2011-04-27 08:06:14 +00:00
|
|
|
}
|
|
|
|
|
2012-04-19 14:49:55 +00:00
|
|
|
func GetMessage(msg *Msg, hwnd syscall.Handle, MsgFilterMin uint32, MsgFilterMax uint32) (ret int32, err error) {
|
|
|
|
r0, _, e1 := syscall.Syscall6(procGetMessageW.Addr(), 4, uintptr(unsafe.Pointer(msg)), uintptr(hwnd), uintptr(MsgFilterMin), uintptr(MsgFilterMax), 0, 0)
|
|
|
|
ret = int32(r0)
|
|
|
|
if ret == -1 {
|
|
|
|
if e1 != 0 {
|
|
|
|
err = error(e1)
|
|
|
|
} else {
|
|
|
|
err = syscall.EINVAL
|
|
|
|
}
|
|
|
|
}
|
|
|
|
return
|
2011-04-27 08:06:14 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
func TranslateMessage(msg *Msg) (done bool) {
|
2012-04-19 14:49:55 +00:00
|
|
|
r0, _, _ := syscall.Syscall(procTranslateMessage.Addr(), 1, uintptr(unsafe.Pointer(msg)), 0, 0)
|
|
|
|
done = bool(r0 != 0)
|
|
|
|
return
|
2011-04-27 08:06:14 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
func DispatchMessage(msg *Msg) (ret int32) {
|
2012-04-19 14:49:55 +00:00
|
|
|
r0, _, _ := syscall.Syscall(procDispatchMessageW.Addr(), 1, uintptr(unsafe.Pointer(msg)), 0, 0)
|
|
|
|
ret = int32(r0)
|
|
|
|
return
|
|
|
|
}
|
|
|
|
|
|
|
|
func LoadIcon(instance syscall.Handle, iconname *uint16) (icon syscall.Handle, err error) {
|
|
|
|
r0, _, e1 := syscall.Syscall(procLoadIconW.Addr(), 2, uintptr(instance), uintptr(unsafe.Pointer(iconname)), 0)
|
|
|
|
icon = syscall.Handle(r0)
|
|
|
|
if icon == 0 {
|
|
|
|
if e1 != 0 {
|
|
|
|
err = error(e1)
|
|
|
|
} else {
|
|
|
|
err = syscall.EINVAL
|
|
|
|
}
|
|
|
|
}
|
|
|
|
return
|
|
|
|
}
|
|
|
|
|
|
|
|
func LoadCursor(instance syscall.Handle, cursorname *uint16) (cursor syscall.Handle, err error) {
|
|
|
|
r0, _, e1 := syscall.Syscall(procLoadCursorW.Addr(), 2, uintptr(instance), uintptr(unsafe.Pointer(cursorname)), 0)
|
|
|
|
cursor = syscall.Handle(r0)
|
|
|
|
if cursor == 0 {
|
|
|
|
if e1 != 0 {
|
|
|
|
err = error(e1)
|
|
|
|
} else {
|
|
|
|
err = syscall.EINVAL
|
|
|
|
}
|
|
|
|
}
|
|
|
|
return
|
|
|
|
}
|
|
|
|
|
|
|
|
func SetCursor(cursor syscall.Handle) (precursor syscall.Handle, err error) {
|
|
|
|
r0, _, e1 := syscall.Syscall(procSetCursor.Addr(), 1, uintptr(cursor), 0, 0)
|
|
|
|
precursor = syscall.Handle(r0)
|
|
|
|
if precursor == 0 {
|
|
|
|
if e1 != 0 {
|
|
|
|
err = error(e1)
|
|
|
|
} else {
|
|
|
|
err = syscall.EINVAL
|
|
|
|
}
|
|
|
|
}
|
|
|
|
return
|
|
|
|
}
|
|
|
|
|
|
|
|
func SendMessage(hwnd syscall.Handle, msg uint32, wparam uintptr, lparam uintptr) (lresult uintptr) {
|
|
|
|
r0, _, _ := syscall.Syscall6(procSendMessageW.Addr(), 4, uintptr(hwnd), uintptr(msg), uintptr(wparam), uintptr(lparam), 0, 0)
|
|
|
|
lresult = uintptr(r0)
|
|
|
|
return
|
|
|
|
}
|
|
|
|
|
|
|
|
func PostMessage(hwnd syscall.Handle, msg uint32, wparam uintptr, lparam uintptr) (err error) {
|
|
|
|
r1, _, e1 := syscall.Syscall6(procPostMessageW.Addr(), 4, uintptr(hwnd), uintptr(msg), uintptr(wparam), uintptr(lparam), 0, 0)
|
|
|
|
if int(r1) == 0 {
|
|
|
|
if e1 != 0 {
|
|
|
|
err = error(e1)
|
|
|
|
} else {
|
|
|
|
err = syscall.EINVAL
|
|
|
|
}
|
|
|
|
}
|
|
|
|
return
|
|
|
|
}
|