Help with gdip imagesearch (black screen)
Posted: 15 Jun 2021, 09:49
Recently started looking into gdip imagesearch, and ran into a problem. For some reason, it cannot find images in the GTA5 game.
Here's the code I wrote:
It finds coordinates in other applications, but there is a problem with GTA5.
I took a screenshot with the same library and got a completely black screenshot.
The code that took the screenshot:
Help solve the problem, thank you in advance for your time.
Here's the code I wrote:
Code: Select all
#Include Gdip_All.ahk
#Include Gdip_ImageSearch.ahk
pToken := Gdip_Startup()
pHaystack := Gdip_BitmapFromHwnd(WinExist("GTA5"))
pNeedle := Gdip_CreateBitmapFromFile("image.png")
result := Gdip_ImageSearch(pHaystack, pNeedle, outputVar)
Gdip_DisposeImage(pHaystack)
Gdip_DisposeImage(pNeedle)
Gdip_Shutdown(pToken)
if (result = 1)
{
RegExMatch(outputVar, "(.*),(.*)", out)
MsgBox, X: %out1% Y: %out2%
}
else
{
MsgBox, EROR
}
ExitApp
I took a screenshot with the same library and got a completely black screenshot.
The code that took the screenshot:
Code: Select all
#Include Gdip_All.ahk
pToken := Gdip_Startup()
pBitmap := Gdip_BitmapFromHwnd(WinExist("GTA5"))
Gdip_SaveBitmapToFile(pBitmap, A_Desktop "\image.png")
Gdip_DisposeImage(pBitmap)
Gdip_Shutdown(pToken)
ExitApp