With Windows, your application does not print by interacting directly with the printer. Instead, it prints by sending output to a printer device context. This means that, when writing your application, you need not worry about each printer's specific capabilities or requirements.
Printing in Windows is handled by the graphics device interface (GDI). In general, the procedure for printing information is similar to that for displaying information; you retrieve a handle to a device context, then send output to that device context. Typically, an application follows these steps in order to print to the current printer:
1.The application first retrieves information about the current printer, such as its model name, device driver, and printer port, from the WIN.INI initialization file. This information is necessary for the application to create a device context for the current printer.
2.When your application sends output to a printer device context, Windows activates the print spooler to manage the print request.
3.Your application uses six printer functions to control the print job. If necessary, your application can use printer escapes to communicate with the printer's device driver.