05-13-2020, 02:29 AM
[moved from General]
I'm curious about how the scan and wait functions work. they can work in the background and quickly find images even in windows that don't support PrintWindow.
I tried to make a function that can capture the screen in a window that runs in the background, but this window does not support PrintWindow. it will only get black
after I did some research, I found the SetPixel function in gdi32.dll. with this reference I can declare the dll function in my macros, then I use this to get every pixel in the area in the window.
but I think this method is too slow when compared to scan, wait, or CaptureImageOnScreen. to get 155 x 37 image I need up to 3 seconds to complete it, whereas CaptureImageOnScreen can be finished in less than 1 second
how can i speed up the process of this function?
Thanks
Function BackgroundScreenshot
I'm curious about how the scan and wait functions work. they can work in the background and quickly find images even in windows that don't support PrintWindow.
I tried to make a function that can capture the screen in a window that runs in the background, but this window does not support PrintWindow. it will only get black
after I did some research, I found the SetPixel function in gdi32.dll. with this reference I can declare the dll function in my macros, then I use this to get every pixel in the area in the window.
but I think this method is too slow when compared to scan, wait, or CaptureImageOnScreen. to get 155 x 37 image I need up to 3 seconds to complete it, whereas CaptureImageOnScreen can be finished in less than 1 second
how can i speed up the process of this function?
Thanks
Function BackgroundScreenshot
function hwnd x y width height str'path
dll gdi32 #SetPixel hdc x y color
RECT r
r.left = x
r.top = y
r.right = x + width
r.bottom = y + height
__MemBmp m.Create(width height)
int i j
for(j r.top r.bottom)
,for(i r.left r.right)
,,_i=FastPixel(i j hwnd 1)
,,SetPixel m.dc (i - r.left) (j - r.top) _i
SaveBitmap(m.bm path)