PRNINFO: the Windows Printer Inspector. Freeware. (c) Jacques Oberto 1994 =============================================================== 1. Why? ------- One of my graphical applications needed badly a print preview method. To calculate the print preview rectangle with precision, it is necessary to access and retrieve a certain amount of data specific to the printer installed under Windows. The most relevant bits of information in my case are: the page format (e.g. letter, A4,...), the page orientation (portrait or landscape), the dpi resolution, the maximal 'printable' area which needs to take into account the maximal number of pixels in the X and Y dimensions and the X- and Y-offsets (or margins). With a little extra effort I included other info as well. 2. How? ------- To my great displeasure, all that information didn't reside in one single spot but was scattered around in three different places: in the win.ini file, in the printer device driver and in the windows device context. Each time, you need to call a different method to get what you want. A lot of reading through manuals, help files and books was necessary to investigate methods I never used before. Neil J. Rubenking's book "Turbo Pascal for Windows" helped quite a bit. Another complication is that different printer drivers add in the win.ini file different headings that need to be parsed... The information in the device driver and in the device context is more consistent. 3. The PRNINFO Zip file ----------------------- PRNINFO.ZIP can be distributed freely but NO MONEY can be asked for it and. This text file MUST remain included in the archive. The archive contains: PRNINFO.PAS : the BPW source code PRNINFO.RES : the resource file PRNINFO.TXT : this text file PRNINFO.EXE : the executable CTL3D.PAS : BPW Unit for 3D controls CTL3D.DLL : Dynamic Link Library for 3D controls The PRNINFO BPW code is provided with a few comments in the relevant places and it should also work with TPW although I didn't try. I played quite a bit and installed many of the printer drivers provided with Windows to make sure that the code performs as expected. People using third party drivers are on their own but I'd like to hear from them. The code is freeware, you can use and modify it as you wish and even include it in your applications with the only condition that you send me an E-mail if you do. Fair enough? 4. What's next? --------------- I am still unable to retrieve some bits of printer information. To name one: how to get the amount of RAM available in an HP LaserJet? If I get enough requests, I might include other functions in the future. 5. How to contact me? --------------------- If you like (or hate) PrnInfo or if you have improved the code please drop a line by at the E-mail address below. I hope you find it useful. Enjoy, Jacques Oberto oberto@ibpc.fr