Basicly I quickly wrote a simple version which translate a small icon in a numerical signature, the only problem is i can use it because after it is ran a couple of times my program crashes without an error; the window moves and becomes unusable(And in my taskmanager window I can see the memory increase by 100kb a time).
I have tryed disabling all other functions in the loop and the only function that causes this problem is the function with GetPixel in it.

I hope anybody with experience can solve my problem, here is the piece of code that causes the trouble:
Code:
Public Function analyseCard(ByVal hwnd As Long, ByVal realX As Long, realY As Long) As String
Dim X As Long
Dim Y As Long
Dim cardValue As Long
    DoEvents
    realX = realX - 1
    realY = realY - 1
    For Y = realY To realY + 10
        For X = realX To realX + 9
            If GetPixel(GetDC(hwnd), X, Y) = vbWhite Then
                DoEvents
                cardValue = cardValue + (X - realX) + (Y - realY)
            End If
        Next
    Next
    
    Select Case cardValue
    Case 78
        analyseCard = "A"
    Case 52
        analyseCard = "B"
    Case 70
        analyseCard = "C"
    Case 72
        analyseCard = "D"
    Case 76
        analyseCard = "E"
    Case 8
        analyseCard = "F"
    Case 105
        analyseCard = "G"
    Case 73
        analyseCard = "H"
    Case 181
        analyseCard = "I"
    Case 69
        analyseCard = "J"
    Case 71
        analyseCard = "K"
    Case 43
        analyseCard = "L"
    Case 63
        analyseCard = "M"
    End Select
End Function
It looks alright to me though..

Thanks,
Pascal.