Page 1 of 1

PB printing and PrintDlg_ API

Posted: Mon Dec 03, 2007 9:50 am
by omit59
Hello!

I would like to use PrintDlg_() API and not PrintRequester(), but still use PB printing commands.
So, how do I use hDC got from PrintDlg_()?

Code: Select all

Global DEVNAMES.DEVNAMES
Global PrintDlg.PRINTDLG
PrintDlg\hDevMode = 0
PrintDlg\hDevNames = 0
PrintDlg\lStructSize = SizeOf(PRINTDLG)
PrintDlg\Flags = #PD_ALLPAGES|#PD_RETURNDC


If PrintDlg_(PrintDlg) <> #False

  ; how to use PrintDlg\hDC here or can I???
  If StartPrinting("Print:")
    printer_DC.l = StartDrawing(PrinterOutput())
      ;...
    StopDrawing()
  StopPrinting()

EndIf 

Anyone having an example for this?

Timo

Posted: Mon Dec 03, 2007 10:29 am
by Hroudtwolf
Hi,

If you set the flag 'PD_RETURNDC' in your PD stucture, you retrieve the device context in structurefield PrintDlg\hDc.
On this dc, you can draw with all Win32 GDI functions.

But, remember at end... You have to release the DC.

Best regards

Wolf

Posted: Mon Dec 03, 2007 10:48 am
by omit59
@Hroudtwolf,

I edited my first post to add #PD_RETURNDC flag (forgot that earlier), but my problem is that I'm not very good with APi and and like to use PB
printing functions StartPrinting() and StartDrawing().
How can I use them or can I at all?

Timo