Question 1: The code for the first few chapters doesn't match the book. It looks as if it was written for DirectX 6 instead of 7.
Solution 1: Please visit the author's website for the corrections:
From the first hour, Sams Teach Yourself DirectX 7 in 24 Hours has you creating your own DirectX-enabled applications. Author Robert Dunlop guides you through the complicated DirectX APIs, empowering you to create your own DirectX powered applications featuring smooth 3D graphics and sound. In addition to laying the COM-based DirectX foundation, Robert covers animation, DirectSound, DirectMusic, Direct3D, control devices, force feedback controls, and multi-user games. This book is an ideal starting point to hone your DirectX skills quickly and easily.