Can't print bitmaps Delphi 1

    Sorry, just realized two of the parameters of StretchDIBits were not
Right and Bottom but actually Width and Height. It has been corrected below:
|    Okay, this is the code as a unit. "Gauche" and "Haut" are the left and
|top of your bitmap on the printed sheet. It could be the x and y of the
|ClientOrigin of a TImage, for instance.
|    Oddly enough, as you can see, I use twice the ratio between the my
|printer's pixels per logical inch property and that of my screen to get the
|exact same physical dimensions. I've seen examples where they used the
ratio
|as it is but it prints very small.
|    Also, the print method of TForm with poProportional as value for the
|PrintScale property will also give you something smaller than the screen.
|This is the code in Forms.pas:
|                  PrintWidth := MulDiv(DIBWidth, GetDeviceCaps(Handle,
|                    LOGPIXELSX), PixelsPerInch);
|                  PrintHeight := MulDiv(DIBHeight, GetDeviceCaps(Handle,
|                    LOGPIXELSY), PixelsPerInch);
|It's actually equivalent to what Paint or other commercial softwares will
|do. It seems to condone the Windows philosophy as justified in the Win32
|Help section that discusses WYSIWYG printing.
|    I just couldnt find anything that would give me the physical height or
|width of my screen. HORZSIZE and VERTSIZE are supposed to do that in
|millimeters and I could work with the conversion but it just returned
|surrealistic values. So this works for me but it might be different for
you.
|If anyone cares to try it, please let me know.
|
|
|unit UImprimI;
|
|interface
|
|uses
|    Windows, Graphics, Printers, Classes;
|
|procedure ImprimerUnBitMap(CarteDOctets: TBitmap; Gauche, Haut: Integer);
|
|implementation
|
|procedure ImprimerUnBitMap(CarteDOctets: TBitmap; Gauche, Haut: Integer);
|var
|   EnTete: PBitmapInfo;
|   Image: Pointer;
|   hImage: THandle;
|   LongueurDeLEnTete, EchelleDesX, EchelleDesY: Integer;
|   {$IFDEF VER90}
|   NombreDOctets: Integer;
|   {$ELSE}
|   NombreDOctets: Longint;
|   {$ENDIF}
|begin
|     with CarteDOctets do
|     begin
|          GetDIBSizes(Handle, LongueurDeLEnTete, NombreDOctets);
|          EnTete:=MemAlloc(LongueurDeLEnTete);
|          Printer.BeginDoc;
|          try
|             hImage := GlobalAlloc(GMEM_FIXED, NombreDOctets);
|             Image := GlobalLock (hImage);
|             GetDIB(Handle, Palette, EnTete^, Image^);
|             EchelleDesX:=2*(GetDeviceCaps(Printer.Handle, LOGPIXELSX) div
|GetDeviceCaps(GetDC(GetDesktopWindow), LOGPIXELSX));
|             EchelleDesY:=2*(GetDeviceCaps(Printer.Handle, LOGPIXELSY) div
|GetDeviceCaps(GetDC(GetDesktopWindow), LOGPIXELSY));
|             StretchDIBits(Printer.Canvas.Handle, Gauche*EchelleDesX,
|Haut*EchelleDesY, Width*EchelleDesX, Height*EchelleDesY, 0,
|0, Width, Height, Image, Entete^, DIB_PAL_COLORS, SRCCOPY);
|          finally
|                 GlobalUnLock (hImage);
|                 GlobalFree (hImage);
|                 FreeMem(EnTete, LongueurDeLEnTete);
|                 Printer.EndDoc;
|          end;
|     end;
|end;
|
|end.
||>I'm printing a bitmap to the  printer using the printer.canvas.draw
||>IT WORKS FINE with Delphi 2 but now I need to do the same in Delphi 1
||>(same printer) and the result is a blank page.
||>
||>Why can't I print bitmaps in Delphi 1 ?