SOLVED!
I just realize CaptureImageOnScreen using
Function CaptureImageOnScreen
which is using srcdc of current screen, i think
while my function not using any srcdc
Function BackgroundScreenshot
so i change it to using dc of window that i want to capture, then it works like CaptureImageOnScreen. Very fast, it finished at same second
Function BackgroundScreenshot
and because it dont need to get and set pixel by pixel anymore, so i remove the dll declaration
I just realize CaptureImageOnScreen using
Function CaptureImageOnScreen
which is using srcdc of current screen, i think
while my function not using any srcdc
Function BackgroundScreenshot
so i change it to using dc of window that i want to capture, then it works like CaptureImageOnScreen. Very fast, it finished at same second
Function BackgroundScreenshot
and because it dont need to get and set pixel by pixel anymore, so i remove the dll declaration