well i didn't want to post my complete code, but heregoes anyway (you can find the memcmp function at the bottom):
int main() { HANDLE hBitMap = LoadImage(0, "img.bmp", IMAGE_BITMAP, 0, 0, LR_LOADFROMFILE); BITMAP bitmap; GetObject(hBitMap,sizeof(BITMAP),&bitmap); int size = bitmap.bmHeight*bitmap.bmWidth*bitmap.bmBitsPixel/8; BYTE *lpBits = new BYTE[ size ]; GetBitmapBits((HBITMAP)hBitMap,size,lpBits ); HANDLE hBitMap2 = LoadImage(0, "img2.bmp", IMAGE_BITMAP, 0, 0, LR_LOADFROMFILE); BITMAP bitmap2; GetObject(hBitMap2,sizeof(BITMAP),&bitmap2); int size2 = bitmap2.bmHeight*bitmap2.bmWidth*bitmap2.bmBitsPixel/8; BYTE *lpBits2 = new BYTE[ size2 ]; GetBitmapBits((HBITMAP)hBitMap2,size2,lpBits2 ); int ScreenWidth = bitmap2.bmWidth; int ScreenHeight = bitmap2.bmHeight; int numOfCard = 1; int cardHeight = bitmap.bmHeight; int card_line_length = bitmap.bmWidth; for( int i = 0 ; i < ScreenWidth; i++ ) { for( int j = 0 ; j < ScreenHeight; j++ ) { for ( int k= 0; k < numOfCard; k++ ) { int tmpY = j; for ( int x = 0; x < cardHeight; x++ ) { if ( memcmp(lpBits2[tmpY],lpBits[x], card_line_length ) != 0 ) break; // we didnt find macth of a line tmpY++; // move to next line } if ( x == cardHeight) { cout << "found"; } } } } system("PAUSE"); return 0;}
As you can see, i have changed it a little to
memcmp(lpBits2[tmpY],lpBits[x], card_line_length )
i know how memcmp works, i am having trouble with getting the bitmaps bits