Change Printer-Settings (WinApi)

forum.sourcecode (2000-2005) & forum.td.sourcecode (2005-2010)
Marc

Change Printer-Settings (WinApi)

Post by Marc » 13 Jul 2006, 16:15

 Posted by:  Marc 

I would like to change the printer-settings, what is incorrect?

Set hPrinterDC = CreateDCA( sDriver, sDevice, STRING_Null, STRING_Null )

If OpenPrinterA( sDevice, hPrinter, STRING_Null )
Set nBufferLength = 32
Call SalStrSetBufferLength( sBuffer, nBufferLength )

If not GetPrinterA( hPrinter, 2, sBuffer, nBufferLength, nBufferLength )
Call SalStrSetBufferLength( sBuffer, nBufferLength )

If not GetPrinterA( hPrinter, 2, sBuffer, nBufferLength, nBufferLength)
Call ClosePrinter( hPrinter )
Call SalMessageBox( 'GetPrinterError','Error', MB_Ok | MB_IconStop )
Return FALSE

Set pDevMode = CStructGetFarPointer( sBuffer, 4*7 )
Call SalStrSetBufferLength( sDevMode, 156 )
Call CStructCopyFromFarMem( pDevMode, sDevMode, 156 )
Set nCopiesOffset = 32+2*4+4+5*2
Set nNbCopies = 4

Call CStructPutWord(sDevMode, nCopiesOffset,nNbCopies)

Set nResult = DocumentPropertiesA( hWndNULL, hPrinter, sDevice,sDevMode,
sDevMode, DM_IN_BUFFER or DM_OUT_BUFFER )
Set hPrinterDC = ResetDCA(hPrinterDC,sDevMode)

Christian Astor

Re: Change Printer-Settings (WinApi)

Post by Christian Astor » 14 Jul 2006, 11:25

 Posted by:  Christian ASTOR 


See eg PrintBitmap() where I changed DEVMODE either by
DocumentPropertiesA() globally or by PrintDlgA()-ResetDCA()

Old sample =>

You do not have the required permissions to view the files attached to this post.

Marc

Re: Change Printer-Settings (WinApi)

Post by Marc » 31 Jul 2006, 16:08

 Posted by:  Marc 

Thank you,

Your Sample works fine.

But, the globally Printer-Settings do not remain stored. please control the
function DocumentProperties once more, that I have changed.

Thank you very much for your understanding.

You do not have the required permissions to view the files attached to this post.

Return to “td.sourcecode”

Who is online

Users browsing this forum: [Ccbot] and 0 guests