Hi guys
I'm seaching an alternative way to ScreenCapture UDF. Why? I think GDI+ is slow if you need to capture many images
Searching on the web for the fastest method i have found:
1) Using Surface DirectX method
2) Using BitBlt method
The Directx method ( here you can find and example in C# ) is probably tha fastest but it's totally out of my knowledge, and i'm not sure can be done in autoit.
For the second i'm sure can be done in autoit and this is what i have make:
#include <WinAPI.au3> ;~ #include <ScreenCapture.au3> ; Testin purpose Global Const $SRCCOPY = 0x00CC0020 $hDDC = _WinAPI_GetDC(0) $hCDC = _WinAPI_CreateCompatibleDC($hDDC) $hBMP = _WinAPI_CreateCompatibleBitmap($hDDC, @DesktopWidth, @DesktopHeight) _WinAPI_SelectObject($hCDC, $hBMP) _WinAPI_BitBlt($hCDC, 0, 0, @DesktopWidth, @DesktopHeight, $hDDC, 0, 0, $SRCCOPY) _WinAPI_ReleaseDC(0, $hDDC) _WinAPI_DeleteDC($hCDC) ;~ _ScreenCapture_SaveImage(@ScriptDir & "\GDIPlus_Image.jpg", $hBMP) ; testing purpose _WinAPI_SaveBMP(@ScriptDir & "\GDIPlus_Image.bmp", $hBMP) ; BMP is sure, PNG if possible. Func _WinAPI_SaveBMP($sFilename, $hData) $file = _WinAPI_CreateFile($sFileName) _WinAPI_CloseHandle($file) ;~ _WinAPI_WriteFile ; ---> Write file header and info header ;~ _WinAPI_CloseHandle($file) ; Close the handle ;~ _WinAPI_WriteFile ; ---> Write data of the bitmap ;~ _WinAPI_CloseHandle($file) EndFunc
As you can see, work if i use GDI-ScreenCapture UDF but the goal is avoid that, if i need to use GDI i'll use the UDF
The main problem is i don't know how to write in the file the information stored in _WinAPI_CreateCompatibleBitmap ( so Save HBITMAP to file )
I need to create the file header, info header and then write the data? ( i think ) but i'm here because i need an help for do the last part of the code.
Thanks