Jump to content
Fivewin Brasil

Seleção de impressora no PREVIEW


ADutheil

Recommended Posts

FWH 15.07 + WIN 10 aniv

A impressão sempre vai para a impressora padrão independentemente da impressora selecionada no preview. Não testei com uma segunda impressora física mas quando mudo para impressora de PDF ou MS XPS sai na HP padrão. Alguém poderia confirmar este comportamento?

Grato.

Link to comment
Share on other sites

Novato, Tente assim:


Se não funcionar, terás que alterar a PRINTER.PRG



REDEFINE BUTTON oImpressora ID 79 OF oDlgRece WHEN( lDanfe ) ;
ACTION( DefaultPrinter() ) CANCEL // MUDEI EM: 15/08/2016 Magda
//ACTION ( PRINTERSETUP() ) CANCEL // MUDEI EM: 16/01/2014 FALHA NA PRINTER.PR ASSIM PAROU DE FUNCIONAR

FUNCTION DefaultPrinter() // MODIFIQUEI A PRINTER.PRG E FUNCIONA...

LOCAL nPrn, nRet

// Abre a tela para a seleção da impressora
/*
GetPrintDC( GetActiveWindow() ) // no me gusta asi. sou xato pra k.... kkkkkkkkkkkkkk

// Coloca a impressora selecionada como Default do Windows
SetDefaultPrinter( PRNGETNAME() )
*/

nRet := PrinterSetUp() // prefiro assim.

nPrn := PrnGetName()

IF( nRet # 0 )

// NADA A FAZER MUDA O DEFULT DA IMPRESSORA EM TEMPO REAL. 15/08/2016(Magda)
SetDefaultPrinter( PRNGETNAME() ) // MUDA O DEFAULT DA IMPRESSORA

MsgInfo( OemToAnsi( "Aten‡Æo Usu rio: " )+CRLF+ ;
OemToAnsi( "Sua Impressora DEFAULT(PadrÆo) ‚: " )+CRLF+ ;
( "-> " + nPrn ), ;
OemToAnsi( "Sua Impressora DEFAULT(PadrÆo) ‚... " ) )

ELSE

MsgInfo( OemToAnsi( "ATEN€ÇO USUµRIO: " )+CRLF+ ;
OemToAnsi( "VERIFIQUE SUA IMPRESSORA SE ESTµ LIGADA. " )+CRLF+ ;
OemToAnsi( "OU SE ESTµ INSTALADA CORRETAMENTE... " )+CRLF+ ;
OemToAnsi( "TEM ALGUMA COISA ERRADA COM A IMPRESSORA?" )+CRLF+ ;
OemToAnsi( "TECLE <ENTER> PARA CONTINUAR... " ), ;
OemToAnsi( "VERIFIQUE SUA IMPRESSORA SE ESTµ LIGADA. " ) )

RETURN( .F. )

ENDIF

RETURN NIL


Link to comment
Share on other sites

Já fiz algo parecido para quebrar o galho mas perde a "belezura" do menuzinho de seleção dentro do preview para voltar ao dialog da época do windows 3. Tenho impressão (sem trocadilho) que tem alguma relação com permissões. Quando executo ocomo administrador não funciona mas também não sai mais para a impressora padrão.

Link to comment
Share on other sites

Assim ficou no rpreview.prg.


METHOD SelPrinter( cPrinter ) CLASS TPreview

local cOldPrinter := GetProfString( "windows", "device" , "" )


DeleteDC( ::oDevice:hDC )

SetDefaultPrinter( cPrinter )

SysRefresh()

PrinterInit()

::oDevice:hDC = GetPrintDefault( GetActiveWindow() )

::oDevice:cModel = cPrinter

SysRefresh()

SetDefaultPrinter( cOldPrinter )

SysRefresh()

PrinterInit()

WriteProfString( "windows", "device", cOldPrinter )

SysRefresh()

RETURN nil
Link to comment
Share on other sites

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

Loading...
×
×
  • Create New...