function IsCharAt(x, y, Tol:Integer; var width: Integer; c: char): Boolean;
var
BitMe, BitGame: TBitmap;
LineMe, LineGame: PRGB32Array;
cx, cy, rColor: Integer;
begin
rColor:= 0;
Result:= True;
BitMe:= TBitmap.Create;
BitMe.Handle:= LoadBitmap(hInstance, 'M');
Width:= Width + BitMe.Width;
ShowMessage(IntToStr(BitMe.width));
BitGame:= TBitmap.Create;
BitGame.Width := BitMe.Width;
BitGame.Height := BitMe.Height;
BitBlt(BitGame.Handle, 0, 0, BitGame.Width, BitGame.Height,
GetWindowDC(Window), x, y, SRCCOPY);
BitGame.PixelFormat:= pf32bit;
BitMe.PixelFormat:= pf32bit;
for cy:= 0 to BitMe.Height do
begin
//Error is here in LineMe:= BitMe.ScanLine[cy]
//though BitMe is loading Right which i can tell because it shows message of correct size
//Erros is ScanLine out of Range error
LineMe:= BitMe.ScanLine[cy];
LineGame:= BitGame.ScanLine[cy];
for cx:= 0 to BitMe.Width do
if(RGB(LineMe[cx].R,LineMe[cx].G,LineMe[cx].B)<>0)then
if(rColor=0)then
rColor:= RGB(LineGame[cx].R, LineGame[cx].G, LineGame[cx].B)
else
if(not SimilarColors(rColor, RGB(LineGame[cx].R, LineGame[cx].G, LineGame[cx].B), Tol))then
Exit;
end;
Result:= True;
end;