To learn more about how DirectDraw can be used in applications, you should check out some of the other following samples included with the DirectX Programmer's Reference:
Demonstrates how to create a nonexclusive (windowed) mode animation in a window that is capable of clipped blitting and stretched-clipped blitting.
Demonstrates testing multiple exclusive-mode applications interacting with nonexclusive-mode applications.
Demonstrates palette animation.
Demonstrates how to retrieve the capabilities of the display hardware.
Other samples you can examine for their DirectDraw code include Duel, Iklowns, Foxbear, Palette, and Flip2d.