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