I need a C++ library called WindowGrab in the namespace "Fusion" created as a static Win32 library (.lib). This library will expose the WindowGrab class that will have a set of functions to capture a window and save it as a PNG file using libpng. The function won't actually save to disk but will save to a sqlite3 database.
bool Init(sqlite3 *pDB); // Database that is already open. Your class should check for a WindowGrab table with the correct columns. If the correct table doesn't exist or the columns are wrong (possibly a wrong version) then wipe it and create the correct table. Same for WinThumbs.
bool SaveWindow(HWND hWnd, __int64 *pResultID, __int64 *pResultThumb); // Given a window handle, save a screen capture of the window as well as a 128x"y" thumbnail in the WinThumbs table. The resulting row (sqlite's internal ROWID value) is returned. The title of the window, class and location are also saved.
Notes: If the call is made within 5 seconds for the same window and no other windows are saved in the meantime, the same results are returned and no new capture is done.
void Dump(HANDLE hOutput, __int64 rowID, bool isThumb) // This will dump the image complete with HTTP headers (content type, content size, no cache header and image data).
void GetInfo(__int64 rowid, TCAPTUREINFO *pInfo) ; // Return a structure with all the info from a capture (title, date, time, etc)
Visual Studio 2005 SLN which includes a small test and the library.