定義された領域をピクセル検索したい。アプリケーションは Bluestacks App Player です:

青い長方形がBlueStacksです(位置は変わる可能性があります)。を使用して位置を取得しControlGetPos()ます。アプリ内の赤い四角形でピクセル検索したいだけです。赤い四角形の位置は、ウィンドウ座標モードのウィンドウ情報に基づいて307,628,355,675です。しかし、それは機能していません。これが私のコードです:
HotKeySet("{F2}", "mulai")
HotKeySet("{F3}", "berhenti")
Global $lokasi[2]
Global $warna
Global $penghitung
Global $nyala
Global $title = "BlueStacks App Player"
Global $hwnd = WinGetHandle($title)
Global $BSpos
Func berhenti()
Exit
EndFunc ;==>berhenti
Func getPos()
$aPos = ControlGetPos($title, "", "[CLASS:BlueStacksApp; INSTANCE:1]")
$tPoint = DllStructCreate("int X;int Y")
DllStructSetData($tPoint, "X", $aPos[0])
DllStructSetData($tPoint, "Y", $aPos[1])
_WinAPI_ClientToScreen(WinGetHandle(WinGetTitle($title)), $tPoint)
$BSpos[0] = DllStructGetData($tPoint, "X")
$BSpos[1] = DllStructGetData($tPoint, "Y")
EndFunc ;==>getPos
Func mulai()
$nyala = 1
While $nyala = 1
$pos = WinGetPos($hwnd)
WinActivate($hwnd)
$lokasi = PixelSearch($BSpos[0] , $BSpos[1], $BSpos[0] + $BSpos[2], $BSpos[1] + $BSpos[3], 0x0185B3)
MouseMove($lokasi[0], $lokasi[1], 0)
Sleep(200)
If @error Then
$penghitung = $penghitung + 1
EndIf
If $penghitung > 5 Then
$nyala = 0
EndIf
WEnd
EndFunc ;==>mulai
While 1
Sleep(200)
WEnd