From ea17cc91acaf30184f4db5224ac8f8846c64b216 Mon Sep 17 00:00:00 2001 From: vCaesar Date: Mon, 28 Nov 2016 20:41:15 +0800 Subject: [PATCH] Add SetHandle --- doc.md | 11 +++++++++++ robotgo.go | 8 ++++---- window/goWindow.h | 5 +++++ zh_doc.md | 11 +++++++++++ 4 files changed, 31 insertions(+), 4 deletions(-) diff --git a/doc.md b/doc.md index 9cd4d0b..3854980 100644 --- a/doc.md +++ b/doc.md @@ -51,6 +51,7 @@ #####[IsValid](#IsValid) #####[SetActive](#SetActive) #####[GetActive](#GetActive) +#####[SetHandle](#SetHandle) #####[GetHandle](#GetHandle) #####[GetTitle](#GetTitle) @@ -460,6 +461,16 @@ func main() { ####Return: Returns hwnd +###

.SetHandle()

+ + Set the Window Handle + +####Arguments: + int + +####Return: + bool + ###

.GetHandle()

Get the Window Handle diff --git a/robotgo.go b/robotgo.go index 7da4c0d..85e5462 100644 --- a/robotgo.go +++ b/robotgo.go @@ -582,10 +582,10 @@ func GetHandle() int { return ghwnd } -// func SetHandle(hwnd int) { -// chwnd := C.uintptr(hwnd) -// C.aSetHandle(chwnd) -// } +func SetHandle(hwnd int) { + chwnd := C.uintptr(hwnd) + C.aSetHandle(chwnd) +} func GetTitle() string { title := C.aGetTitle() diff --git a/window/goWindow.h b/window/goWindow.h index a37f79d..fa10f52 100644 --- a/window/goWindow.h +++ b/window/goWindow.h @@ -32,6 +32,11 @@ void aCloseWindow(void){ CloseWin(); } +bool aSetHandle (uintptr handle){ + bool hwnd=setHandle(handle); + return hwnd; +} + uintptr aGetHandle(){ uintptr hwnd=getHandle(); return hwnd; diff --git a/zh_doc.md b/zh_doc.md index 90009cd..383eece 100644 --- a/zh_doc.md +++ b/zh_doc.md @@ -51,6 +51,7 @@ #####[IsValid](#IsValid) #####[SetActive](#SetActive) #####[GetActive](#GetActive) +#####[SetHandle](#SetHandle) #####[GetHandle](#GetHandle) #####[GetTitle](#GetTitle) @@ -473,6 +474,16 @@ func main() { ####返回值: Returns hwnd +###

.SetHandle()

+ + Set the Window Handle + +####参数: + int + +####返回值: + bool + ###

.GetHandle()

获取窗口 Handle