add CMData return and use

This commit is contained in:
vst 2024-09-13 02:11:49 +08:00
parent 5b9871b063
commit f32ae09772
2 changed files with 19 additions and 0 deletions

View File

@ -34,6 +34,9 @@ func get() {
// get current Window Active
mdata := robotgo.GetActive()
// get current Window Active , return CMData
cmdata := robotgo.GetActiveCMData()
// get current Window Handle
hwnd := robotgo.GetHandle()
fmt.Println("hwnd---", hwnd)
@ -44,6 +47,9 @@ func get() {
// set Window Active
robotgo.SetActive(mdata)
// set Window Active by CMData
robotgo.SetActiveByCMData(cmdata)
}
func findIds() {

View File

@ -90,6 +90,7 @@ type (
CHex C.MMRGBHex
// CBitmap define CBitmap as C.MMBitmapRef type
CBitmap C.MMBitmapRef
CMData C.MData
)
// Bitmap define the go Bitmap struct
@ -874,6 +875,11 @@ func SetActive(win C.MData) {
C.set_active(win)
}
// SetActiveByCMData set the window active by CMData
func SetActiveByCMData(win CMData) {
C.set_active((C.MData)(win))
}
// GetActive get the active window
func GetActive() C.MData {
mdata := C.get_active()
@ -881,6 +887,13 @@ func GetActive() C.MData {
return mdata
}
// GetActiveCMData get the active window, return CMData
func GetActiveCMData() CMData {
mdata := C.get_active()
// fmt.Println("active----", mdata)
return (CMData)(mdata)
}
// MinWindow set the window min
func MinWindow(pid int, args ...interface{}) {
var (