MY FUNC
#include <WinAPISysWin.au3>
Func _imagesearchbg($hwnd, $findimage, $resultposition, $x1, $y1, $right, $bottom, ByRef $x, ByRef $y, $tolerance, $hbmp = 0)
If $tolerance > 0 Then $findimage = "*" & $tolerance & " " & $findimage
If IsString($findimage) Then
$result = DllCall("bg.dll", "str", "ImageSearch", "hwnd", $hwnd, "int", $x1, "int", $y1, "int", $right, "int", $bottom, "str", $findimage)
Else
$result = DllCall("bg.dll", "str", "ImageSearch", "hwnd", $hwnd, "int", $x1, "int", $y1, "int", $right, "int", $bottom, "ptr", $findimage)
EndIf
If $result[0] = "0" Then Return 0
$array = StringSplit($result[0], "|")
$x = Int(Number($array[2]))
$y = Int(Number($array[3]))
If $resultposition = 1 Then
$x = $x + Int(Number($array[4]) / 2)
$y = $y + Int(Number($array[5]) / 2)
EndIf
Return 1
EndFunc
$hwnd = WinGetHandle("Yeni Sekme - Google Chrome")
Global $x,$y
If _imagesearchbg($hwnd,"ara.png",0,0,0,_WinAPI_GetWi ndowWidth($hwnd),_WinAPI_GetWindowHeight($hwnd),$x ,$y,25) = 1 Then
MsgBox(0,$x,$y)
EndIf
But ı try and ı have a error "Subscript used on on-accessible variable"?
#include <WinAPISysWin.au3>
Func _imagesearchbg($hwnd, $findimage, $resultposition, $x1, $y1, $right, $bottom, ByRef $x, ByRef $y, $tolerance, $hbmp = 0)
If $tolerance > 0 Then $findimage = "*" & $tolerance & " " & $findimage
If IsString($findimage) Then
$result = DllCall("bg.dll", "str", "ImageSearch", "hwnd", $hwnd, "int", $x1, "int", $y1, "int", $right, "int", $bottom, "str", $findimage)
Else
$result = DllCall("bg.dll", "str", "ImageSearch", "hwnd", $hwnd, "int", $x1, "int", $y1, "int", $right, "int", $bottom, "ptr", $findimage)
EndIf
If $result[0] = "0" Then Return 0
$array = StringSplit($result[0], "|")
$x = Int(Number($array[2]))
$y = Int(Number($array[3]))
If $resultposition = 1 Then
$x = $x + Int(Number($array[4]) / 2)
$y = $y + Int(Number($array[5]) / 2)
EndIf
Return 1
EndFunc
$hwnd = WinGetHandle("Yeni Sekme - Google Chrome")
Global $x,$y
If _imagesearchbg($hwnd,"ara.png",0,0,0,_WinAPI_GetWi ndowWidth($hwnd),_WinAPI_GetWindowHeight($hwnd),$x ,$y,25) = 1 Then
MsgBox(0,$x,$y)
EndIf
But ı try and ı have a error "Subscript used on on-accessible variable"?