News:

MASM32 SDK Description, downloads and other helpful links
MASM32.com New Forum Link
masmforum WebSite

Printing a bmp image

Started by RuiLoureiro, September 18, 2010, 02:40:03 PM

Previous topic - Next topic

RuiLoureiro

          Meanwhile i need to print an image to the printer
          but i dont know how till now
          I know the printer device context ...
          Could you help me ?
          Thanks
RuiLoureiro         

RuiLoureiro

Hi
    If i use this PrintImagem it prints in _hdc screen device context.
    If i use _hpdc (printer device context) it does nothing.
    Why ?
   
Quote
_TDBitmap1      db "TDBitmap1", 0
;.................................
$DIMx$      equ 300
$DIMy$      equ 180
PrintImagem     proc
                LOCAL   hBmp, hMemDC, x, y:DWORD

                mov     eax, _ClientDimX
                sub     eax, $DIMx$
                shr     eax, 1
                mov     x, eax
               
                mov     eax, _ClientDimY
                sub     eax, $DIMy$
                shr     eax, 1
                mov     y, eax
                   
                invoke  LoadBitmap, _hInstance, addr _TDBitmap1
                mov     hBmp,eax
                invoke  CreateCompatibleDC, _hdc
                mov     hMemDC,eax
                invoke  SelectObject,hMemDC, hBmp
                push    eax
                invoke  StretchBlt,_hdc,x,y,$DIMx$,$DIMy$,hMemDC,0,0,300,180,SRCCOPY

                pop     eax
                invoke  SelectObject, hMemDC,eax
                invoke  DeleteObject, hBmp
                invoke  DeleteDC, hMemDC
                ret
PrintImagem     endp