What JSoftware said. You must declare the message handler as a normal function outside of the class. When you call Initialize, pass Self as the pvUserContext parameter. In the message handler, typecast the pvUserContext parameter to TDirectPlayServer to access members of the class.

This is how I have done the same thing in my own DirectPlay classes.