Diagnostic classification models (DCMs) can be used to track the cognitive learning states of students across multiple time points or over repeated measurements. This study developed an effective variational Bayes (VB) inference method for hidden Markov longitudinal general DCMs. The simulations performed in this study verified the validity of the proposed algorithm for satisfactorily recovering the true parameters. Simulation and applied data analyses were conducted to compare the proposed VB method to Markov chain Monte Carlo (MCMC) sampling. The results revealed that the parameter estimates provided by the VB method are consistent with the MCMC method with the additional benefit of a faster estimation time. The comparative simulation also indicated differences between the two methods in terms of posterior standard deviation and coverage of 95% credible intervals. Thus, with limited computational resources and time, the proposed VB method can output comparable estimations with that of MCMC.