Hello all, I wrote a function to find a pixel on my bitmap then draw a 10x10 square on the location it finds it.
I first paint the bitmap onto my window, then scan a specific location TLX(top left x) and BRY(bottom right Y) for the collor
dark red (0xCC0000)
(ALSO! how do I incriment a hex value? so I could go from 110000 to FF0000)
if it doesnt find it, it puts a 20x20 square on the screen.
If you see something wrong with my function or something that should be changed plz tell me.
Thankyou!
Edit: The problem is it doesnt find itCode:void SearchArea(int TLX,int TLY,int BRX,int BRY) { int X; int Y; COLORREF clr; COLORREF clr2; HDC hdcScrn; POINT pt; pt.x = 0; clr2 = 0xCC0000; hdcScrn=CreateDC("DISPLAY",0,0,0); for(Y = 0; Y <= BRY ;Y++) { for(X = 0; X<= BRX ; X++) { clr=GetPixel(hdcScrn,TLX+X,TLY+Y); if(clr == clr2) { pt.x = TLX+X; pt.y = TLY+Y; } } if(pt.x != 0) { BitBlt(bmoMap, pt.x, pt.y, 10, 10, bmoStar, 0, 0, SRCPAINT); } else { BitBlt(bmoMap, 400, 400, 20, 20, bmoStar, 0, 0, SRCPAINT); } DrawMap(); }



LinkBack URL
About LinkBacks


