How do you guarantee that liCnt is returning an integer from SendMessage?

MKI(CInt(liCnt)... will cause a problem otherwise. Why not use CLng instead and pass as a long to MKI(x As Integer). Maybe you cannot change that function declaration for some reason, but you immediately cast it back to Long anyway. WHY???!

Hope it helps,

Cheers,

Paul.