Path: utzoo!utgpu!news-server.csri.toronto.edu!rpi!dali.cs.montana.edu!uakari.primate.wisc.edu!crdgw1!uunet!mnemosyne.cs.du.edu!isis.cs.du.edu!ebergman From: ebergman@isis.cs.du.edu (Eric Bergman-Terrell) Newsgroups: comp.windows.ms.programmer Subject: printer banding details & question Message-ID: <1991May2.142106.7628@mnemosyne.cs.du.edu> Date: 2 May 91 14:21:06 GMT Sender: usenet@mnemosyne.cs.du.edu (netnews admin account) Reply-To: ebergman@isis.cs.du.edu (Eric Bergman-Terrell) Organization: Nyx, Public Access Unix (sponsored by U. of Denver Math/CS dept.) Lines: 51 Disclaimer1: Nyx is a public access Unix system run by the University of Denver Disclaimer2: for the Denver community. The University has neither control over Disclaimer3: nor responsibility for the opinions of users. Windows will let you print an image one "band" at a time, rather than having to print the entire screen all at once (Petzold, chapter 15). I'm working on a program that prints the screen bitmap to the printer. The program had to allocate a bitmap equal to the size of the region being printed. Thus banding allowed me to keep that bitmap reasonably small. However, in some situations, the windows NEXTBAND escape would return a rectangle that corresponded to the entire printing region. Ouch - my program would try to allocate a > 1 meg bitmap when printing to a laser printer (and crash if it couldn't get the memory). The reason: On the first band, the driver may give the application a full-page band and ask for text only (Prog. Ref., 12-4). The solution is to use the BANDINFO escape to make sure that you haven't been given this full-screen, text-only band. This is documented in the Prog. Ref. but unfortunately not in Petzold (if memory serves). NOW A QUESTION: The BANDINFO escape takes two parameters of type BANDINFOSTRUCT: typedef struct { BOOL fGraphicsFlag; BOOL fTextFlag; RECT GraphicsRect; } BANDINFOSTRUCT; While this declaration is given in the prog. ref., it's not in my copy of windows.h (which came with BC++ 2.0). At any rate, when I call the BANDINFO escape, the flags have the correct values and the function return value indicates success, but the GraphicsRect values are all bogus (e.g. some are negative). Anyone know why? Has the BANDINFOSTRUCT layout changed since the prog. ref. was printed? BTW I don't use the GraphicsRect, but it makes me nervous that it's full of bogus values. And yes, I am setting the GraphicsRect field of lpInData to something reasonable... Thanks in advance Terrell