This article explains how to build a direct 3D application using MFC.
How to implement Direct Input 8 for the mouse and keyboard in MFC.