【正文】
o another process, but behind the scenes Windows converts the devicedependent bitmap to a DIB and copies the DIB to shared memory. That39。s a useful technique that would be difficult to master without an example.) GDI Bitmaps and DeviceIndependentBitmaps There are two kinds of Windows bitmaps: GDI bitmaps and DIBs. GDI bitmap objects are represented by the Microsoft Foundation Class (MFC) Library version CBitmap class. The GDI bitmap object has an associated Windows data structure, maintained inside the Windows GDI module, that is devicedependent. Your program can get a copy of the bitmap data, but the bit arrangement depends on the display hardware. GDI bitmaps can be freely transferred among programs on a single puter, but because of their device dependency, transferring bitmaps by disk or modem doesn39。ll get better performance. The Win32 function CreateDIBSection gives you the benefits of DIBs bined with all the features of GDI bitmaps. Finally, you39。ll graduate to the modern way of programming bitmaps— creating deviceindependent bitmaps (DIBs). If you use DIBs, you39。s object modules are statically linked during the build process. Windows allows dynamic linking, which means that specially constructed libraries can be loaded and linked at runtime. Multiple applications can share dynamic link libraries (DLLs), which saves memory and disk space. Dynamic linking increases program modularity because you can pile and test DLLs separately. Designers originally created DLLs for use with the C language, and C++ has added some plications. The MFC developers succeeded in bining all the application framework classes into a few readybuilt DLLs. This means that you can statically or dynamically link the application framework classes into your application. In addition, you can create your own extension DLLs that build on the MFC DLLs. Chapter 22 includes information about creating MFC extension DLLs and regular DLLs. The Win32 Application Programming Interface Early Windows programmers wrote applications in C for the Win16 application programming interface (API). Today, if you want to write 32bit applications, you must use the new Win32 API, either directly or indirectly. Most Win16 functions have Win32 equivalents, but many of the parameters are different— 16bit parameters are often replaced with 32bit parameters, for example. The Win32 API offers many new functions, including functions for disk I/O, which was formerly handled by MSDOS calls. With the 16bit versions of Visual C++, MFC programmers were largely insulated from these API differences because they wrote to the MFC standard, which was designed to work with either Win16 or Win32 underneath. Bitmaps Without graphics images, Microsoft Windowsbased applications would be pretty dull. Some applications depend on images for their usefulness, but any application can be spruced up with the addition of decorative clip art from a variety of sources. Windows bitmaps are arrays of bits mapped to display pixels. That might sound simple, but you have to learn a lot about bitmaps before you can use them to create professional applications for Windows. This chapter starts with the old way of programming bitmaps— creating the devicedependent GDI bitmaps that work with a memory device context. You need to know these techniques because many programmers are still using them and you39。t worry. That39。re layin