One traditionally considers positive measures in the moment problem. However, this restriction makes its theory and application limited. The main purpose of this paper is to generalize it to deal with complex measures. More precisely, the theory of the truncated moment problem is extended to include complex measures. This extended theory provides considerable flexibility in its applications. In fact, we also develop an approximation technique based on control of moments. The key idea is to use the heat equation as a link that connects the generalized moment problem and this approximation technique. The backward moment of a measure is introduced as the moment of a solution to the heat equation at a backward time and then used to approximate the given measure. This approximation gives a geometric convergence order as the number of moments under control increases. Numerical examples are given that show the properties of approximation technique.