News:

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

Printing Windows

Started by digelo, January 23, 2011, 11:48:55 AM

Previous topic - Next topic

digelo

Hi. I use Polyline to draw some curves on my windows. I wanna print this curves with some details, i know a way that i can use printer hdc for drawing my curves, but for that i should draw everything again and i guess thats not a logical way for reporting, plz show me some better way for reporting .
Thanks.

jj2007

It is a logical way because your printer has a much higher resolution.

digelo

So for Reporting its best way?

jj2007

Quote from: digelo on January 23, 2011, 12:18:03 PM
So for Reporting its best way?

Yes. Go ahead, write some code using printerdc and createdc and releasedc etc., post it here (complete code plz), and I am sure somebody will help you with the error messages.

digelo


PrintStuff  proc  hWndParent:HWND, px1:DWORD, py1:DWORD, px2:DWORD, py2:DWORD, hdcWin:DWORD, wx1:DWORD, wy1:DWORD, wx2:DWORD, wy2:DWORD
LOCAL p: PRINTDLG
LOCAL _di:DOCINFO
LOCAL p2:PRINTDLG
LOCAL prx,pry:dword
LOCAL b:BITMAP
LOCAL buff[256]:dword
LOCAL p_dim:POINT
LOCAL p_dim2:POINT
LOCAL psd:PAGESETUPDLG

invoke memfill, addr _di,sizeof DOCINFO,0
mov _di.cbSize,sizeof DOCINFO

mov _di.lpszDocName,eax
mov _di.lpszOutput,0
mov _di.lpszDatatype,0
mov _di.fwType,0

invoke memfill, addr p2,sizeof PRINTDLG-4,0
mov p2.lStructSize,sizeof PRINTDLG
mov p2.Flags,PD_RETURNDC or PD_USEDEVMODECOPIESANDCOLLATE
        mov p2.nToPage,1000
        mov p2.nMinPage,1
        mov p2.nMaxPage,1000
       
      invoke PrintDlg,addr p2
      .if eax!=0
      .if p2.hDC==0
      invoke MessageBox,0,CADD("Printer DC is wrong"),0,0
      .endif
     
      invoke GetDeviceCaps,p2.hDC,HORZRES
      mov p_dim.x,eax
      invoke GetDeviceCaps,p2.hDC,VERTRES
      mov p_dim.y,eax
     
     
     
      invoke StartDoc,p2.hDC,addr _di
      .if eax==SP_ERROR
      invoke MessageBox,0,CADD("Cannot start, document"),0,0
      .endif
     
      invoke StartPage,p2.hDC
      .if eax<=0
      invoke MessageBox,0,CADD("Cannot start printer"),0,0
      .endif
     
     

                invoke  TextOut,p2.hDC,100,200,SADD("YuuHuuu.... !")


      ;invoke  Polyline,p2.hDC,vPrint,1000;
     
      invoke EndPage,p2.hDC
      invoke EndDoc,p2.hDC
     
      invoke DeleteDC,p2.hDC
     
      .endif

    ret
PrintStuff endp




Finally its my Print Proc  :D

jj2007