lelejau 0 Light Poster

I have this code to take a screenshot of my app window:

BOOL TakeScreenshot()
{
	struct tagPOINT Point;
	struct _SYSTEMTIME SystemTime;
	HWND handle = (HWND)WINDOW_HANDLE;
	if(handle)
	{
		CreateDirectoryA("Capture",0);
		RECT r;
		GetClientRect(handle,&r);

		Point.x = r.left;
		Point.y = r.top;
		
		ClientToScreen(handle,&Point);
		OffsetRect(&r,Point.x,Point.y);

		HDC cr = CreateDCA("DISPLAY",0,0,0);
		HDC cr1 = CreateCompatibleDC(cr);
		HBITMAP ho = CreateCompatibleBitmap(cr,r.right - r.left,r.bottom - r.top);
		HGDIOBJ s = SelectObject(cr1,ho);
		GetLocalTime(&SystemTime);
		

		BitBlt(cr1,0,0,r.right,r.bottom,cr,r.left,r.top,0xCC0020);
		SelectObject(cr1,s);
		DeleteDC(cr1);
		DeleteDC(cr);

		BITMAP bmpScreen;
		GetObject(ho,sizeof(BITMAP),&bmpScreen);
		
		BITMAPFILEHEADER   bmfHeader; 
		BITMAPINFOHEADER bi;

		bi.biSize			= sizeof(BITMAPINFOHEADER);    
		bi.biWidth			= bmpScreen.bmWidth;    
		bi.biHeight			= bmpScreen.bmHeight;  
		bi.biPlanes			= 1;    
		bi.biBitCount		= 32;    
		bi.biCompression	= BI_RGB;    
		bi.biSizeImage		= 0;  
		bi.biXPelsPerMeter	= 0;    
		bi.biYPelsPerMeter	= 0;    
		bi.biClrUsed		= 0;    
		bi.biClrImportant	= 0;

		DWORD dwBmpSize = ((bmpScreen.bmWidth * bi.biBitCount + 31) / 32) * 4 * bmpScreen.bmHeight;
		HANDLE hDIB = GlobalAlloc(GHND,dwBmpSize); 
		char *lpbitmap = (char *)GlobalLock(hDIB);

		GetDIBits(GetDC(handle),ho,0,(UINT)bmpScreen.bmHeight,lpbitmap,(BITMAPINFO*)&bi,DIB_RGB_COLORS);
		HANDLE hFile = CreateFileA("Capture\\image.bmp",GENERIC_WRITE,0,NULL,CREATE_ALWAYS,FILE_ATTRIBUTE_NORMAL, NULL);   
		DWORD dwSizeofDIB = dwBmpSize + sizeof(BITMAPFILEHEADER) + sizeof(BITMAPINFOHEADER);
		bmfHeader.bfOffBits = (DWORD)sizeof(BITMAPFILEHEADER) + (DWORD)sizeof(BITMAPINFOHEADER); 
		bmfHeader.bfSize = dwSizeofDIB; 
		bmfHeader.bfType = 0x4D42; //BM
		DWORD dwBytesWritten = 0;
		WriteFile(hFile, (LPSTR)&bmfHeader, sizeof(BITMAPFILEHEADER), &dwBytesWritten, NULL);
		WriteFile(hFile, (LPSTR)&bi, sizeof(BITMAPINFOHEADER), &dwBytesWritten, NULL);
		WriteFile(hFile, (LPSTR)lpbitmap, dwBmpSize, &dwBytesWritten, NULL);
		GlobalUnlock(hDIB);    
		GlobalFree(hDIB);
		CloseHandle(hFile);
	}
	return TRUE;
}

But I'd like to write in the top of the image some informations, like, the time the screenshot was taken, etc.. how can I do that?
I already have the struct defined, but dont know what to do with it...

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.