Are you sure? Your supposed to be casting to a LONG_PTR here not a long. C++ allows you to cast to any point time with the reservation that you have a pointer type.