PB printing and PrintDlg_ API

Just starting out? Need help? Post your questions and find answers here.
omit59
User
User
Posts: 63
Joined: Fri Mar 11, 2005 8:41 am
Location: Finland

PB printing and PrintDlg_ API

Post 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
Last edited by omit59 on Mon Dec 03, 2007 10:40 am, edited 1 time in total.
User avatar
Hroudtwolf
Addict
Addict
Posts: 803
Joined: Sat Feb 12, 2005 3:35 am
Location: Germany(Hessen)
Contact:

Post 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
omit59
User
User
Posts: 63
Joined: Fri Mar 11, 2005 8:41 am
Location: Finland

Post 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
Post Reply