Converted from VC6.