I am trying to use gdip to create a pbitmap from an area of the screen and then use Gdip_SetPixel from a different script to change pixel colors of it in an attempt to speed up the process of helping the first script change all the colors of a large bitmap by making it multithreaded.
This does not work for some reason:
;script 1
screen51=50|50|20|20
raster := 0x40000000 + 0x00CC0020
pToken := Gdip_StartUp()
pBitmap := Gdip_BitmapFromScreen(screen51,raster)
run, 2.ahk %pBitmap%
sleep 500 ;time to allow second script to change pixel color
Gdip_SaveBitmapToFile(pBitmap,"test.bmp")
Gdip_DisposeImage(pBitmap)
Gdip_Shutdown(pToken)
run, test.bmp
;script 2
pBitmap=%1%
x=10
y=10
color=0xffffffff
Gdip_SetPixel(pBitmap, x, y, color)
Access a pbitmap from a different script than the one that created it
Re: Access a pbitmap from a different script than the one that created it
That won't work. A pBitmap is stored inside a scripts memory accessing it from outside might be possible but is definitivrly slower than doing it from the same script.
Recommends AHK Studio
Re: Access a pbitmap from a different script than the one that created it
it can be done, but u need to use ahk_h.
if u check errorlevel ull see it fails with 0xc0000005 access violation
if u check errorlevel ull see it fails with 0xc0000005 access violation
Re: Access a pbitmap from a different script than the one that created it
That would also involve using the same script but real multi-threading.
regardless of what you are doing there probably is a faster way of what you are doing without using multi-threading.
regardless of what you are doing there probably is a faster way of what you are doing without using multi-threading.
Recommends AHK Studio
Re: Access a pbitmap from a different script than the one that created it
It is possibly can be done with InjectAhkDll():
https://autohotkey.com/board/topic/85304-solvedget-other-processs-working-dir/page-3#entry544650
https://autohotkey.com/board/topic/85304-solvedget-other-processs-working-dir/page-3#entry544650
Re: Access a pbitmap from a different script than the one that created it
Thanks a lot for replies.I had no idea multi threading was possible without multiple scripts.I will definitely have to do some research on how to do it and if it will work with ahk L though since my current code is written in and working with L
Re: Access a pbitmap from a different script than the one that created it
AHK_H is n extension of AHK_L almost all scripts will work for AHK_H if they work for _L
Recommends AHK Studio
Who is online
Users browsing this forum: Billykid, dinodragon, mcd and 153 guests