Deal Me In

Every Windows programmer has access to one powerful graphics library: CARDS, the dynamic link library that is used by Solitaire and other Windows-based card games. In one form or another, CARDS comes with all versions of Windows. Figure 7-11 shows the CARDS library in action in the Fun 地 Games program.

The Visual Basic interface is easy for hardcore programmers; it痴 just a matter of calling the five functions in CARDS32.DLL. Unfortunately, getting the right CARDS32.DLL is not as easy as it should be. Windows NT provides a 32-bit version named CARDS.DLL葉he only DLL I have ever encountered that has exactly the same name as a 16-bit DLL. If you install Windows NT over Windows 3.x, you値l have 16-bit CARDS.DLL in your Windows directory and 32-bit CARDS­.DLL in your System directory. Windows 95 provides only the 16-bit CARDS.DLL. Apparently, the designers figured that card games were out and action games were in. The Fun 地 Games program needs to find the 32-bit DLL regardless of your operating system. I solved this incompatibility problem by getting permission to provide a 32-bit version of the DLL named CARDS32.DLL, which will be copied to your disk by the companion CD setup regardless of your operating system. You can write and run 32-bit card games even on Windows 95. The Windows NT card games expect a 32-bit CARDS.DLL, so you値l have to keep this duplicate on your Windows NT disk if you want to play the standard games.

Figure 7-11. Using CARDS32.DLL in the Fun 地 Games program.

I値l describe the five functions and a few basic game techniques here; check the Fun 地 Games code for details. The hard part is programming the logic of your favorite card game.