Hey guys,
I have never dealt with bitmap handling whatsoever. I googled for some time yet wasn't able to find anything that would work with my dev-cpp.
What I intend to accomplish here is to emulate a user pressing the printscreen button, loading the clipboard data to a bitmap, crop&pan it to a certain size and compare it to a bmp file saved in my program directory.
this should load my bmp file to a bitmap
#include <iostream>
#include <fstream>
#include <windows.h>
using namespace std;
int main(){
unsigned char Header[0x435],image[256][256];
FILE* fp=fopen("Unbenannt.bmp","r");
fread(Header,1,0x435,fp); // copy image header to Header array
fseek(fp,0x436,SEEK_SET); // Move file pointer to start of image data
fread(image,1,256*256,fp); // read image data and copy to ImageIn1[][] array
fclose(fp);
and this should load the clipboard data to the bitmap
if ( OpenClipboard(NULL) )
{
HBITMAP handle = (HBITMAP)GetClipboardData(CF_BITMAP);
CBitmap * bm = CBitmap::FromHandle(handle);
ClientDC cdc(this);
HDC dc;
dc.CreateCompatibleDC(&cdc);
dc.SelectObject(bm);
cdc.BitBlt(0,0,200,200,&dc,0,0,SRCCOPY);
CloseClipboard();
}
however it reports problems such as CBitmap, FromHandle, ClientDC undeclared
I don't know what to do as I have no experience. Could someone please help me get this into shape?
Thanks