It would help if you set the ScaleMode of the pictureboxes to Pixel before you loaded the pictures into them, and also set the auto-redraw property to true.

So, the algorithm would look something like:

Dim x as long

Dim y as long

Dim m as long

Dim p as long

' Search every line of pixels in PicA

For y = 0 to (PicA.ScaleHeight - PicB.ScaleHeight)

' Search every column of pixels in PicA

For x = 0 to (PicA.ScaleWidth - PicB.ScaleWidth)

' Search every row of pixels in PicB

For m = 0 to PicB.ScaleHeight

' Search every column of pixels in PicB

For p = 0 to PicB.ScaleWidth

' if any one pixel doesn't match, then you haven't found PicB in PicA

' so, move on to the next pixel in PicA

IF PicA.GetPixel(x + p, y + m) <> PicB.GetPixel(p, m) Then

GoTo Continue

ELSE IF ((m = PicB.ScaleHeight) AND (p = PicB.ScaleWidth)) Then

' if you have compared every pixel in PicB with PicA and they have all matched

' then X and Y are the coordinates of where the upper left corner of PicB appears in PicA

GoTo Succeeded

End If

Next p

Next m

Continue:

Next x

Next y

' If it falls through here, you didn't find the picture

Failed:

msgbox "Failed to find picture"

exit sub

' if you goto here, you were successful

Succeeded:

msgbox "PicB was found at coordinates X:" & CStr(x) & " Y:" & Cstr(y)

exit sub

Some caveats... wherever I mention ScaleHeight and ScaleWidth, you might need to use ScaleHeight - 1 and ScaleWidth - 1, I can't remember how the indexing works. You'll know if you do this:

Dim c as long

c = PicB.GetPixel(PicB.ScaleWi

If you do that and get an Index out of bounds... then you need to use ScaleWidth - 1 and ScaleHeight - 1

Also, you note that I'm only searching PicA from 0 to PicA.ScaleHeight - PicB.ScaleHeight (same for width), that is because if PicB is 100 pixels tall, and I'm less than 100 pixels from the bottom of PicA, I'm not going to find the image, because PicB won't fit in the space below.

Again, you might need to double-check what the limit should be... it could be any of these:

For Y = 0 to (PicA.ScaleHeight - PicB.ScaleHeight)

For Y = 0 to ((PicA.ScaleHeight - PicB.ScaleHeight) - 1)

For Y = 0 to ((PicA.ScaleHeight - 1) - (PicB.ScaleHeight - 1)