[comp.windows.ms.programmer] info. about banding & question

ebergman@isis.cs.du.edu (Eric Bergman-Terrell) (05/02/91)

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

ebergman@isis.cs.du.edu (Eric Bergman-Terrell) (05/03/91)

Once again I'll answer my own question:   the GraphicsRect field is not
defined for the output structure passed to the BANDINFO escape.


Terrell