SetPrintDefault no funciona en Windows 10 (solucionado)

SetPrintDefault no funciona en Windows 10 (solucionado)

Postby AngelSalom » Tue Oct 04, 2016 11:01 am

Hola amigos, estoy usando la función SetPrintDefault para establecer la impresora por defecto en el sistema. Hasta ahora bien pero con Windows 10 y la última actualización no tiene efecto.
¿Alguna solución?
Gracias,
Last edited by AngelSalom on Tue Oct 04, 2016 3:51 pm, edited 1 time in total.
Angel Salom
Visionwin Software - https://www.visionwin.com
------------------------------------------------------------
fwh 19.05 - harbour 3.2 - bcc 7.4
User avatar
AngelSalom
 
Posts: 708
Joined: Fri Oct 07, 2005 7:38 am
Location: Benicarló (Castellón ) - España

Re: SetPrintDefault no funciona en Windows 10

Postby AngelSalom » Tue Oct 04, 2016 3:13 pm

Sigo, en server 2008,2012 con usuarios que no son propietarios del ejecutable tampoco. ¿Me huelo un tema de permisos?
El código de SetPrintDefault parece que modifica valores del registro ...

Code: Select all  Expand view
function SetPrintDefault( cModel )

   local cDriver := StrToken( GetProfString( "Devices", cModel, "" ), 1, "," )
   local cPort   := StrToken( GetProfString( "Devices", cModel, "" ), 2, "," )

   WriteProfString( "Windows", "Device", cModel + "," + cDriver + "," + cPort )

return nil
Angel Salom
Visionwin Software - https://www.visionwin.com
------------------------------------------------------------
fwh 19.05 - harbour 3.2 - bcc 7.4
User avatar
AngelSalom
 
Posts: 708
Joined: Fri Oct 07, 2005 7:38 am
Location: Benicarló (Castellón ) - España

Re: SetPrintDefault no funciona en Windows 10

Postby karinha » Tue Oct 04, 2016 3:14 pm

Mira se ayuda:

Code: Select all  Expand view

FUNCTION DefaultPrinter()

   LOCAL nPrn, nRet

   /*
   GetPrintDC( GetActiveWindow() )

   SetDefaultPrinter( PRNGETNAME() )
   */


   nRet := PrinterSetUp()

   nPrn := PrnGetName()

   IF( nRet # 0 )

      SetDefaultPrinter( PRNGETNAME() )

      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
 


João Santos - São Paulo - Brasil - Phone: +55(11)95150-7341
User avatar
karinha
 
Posts: 7213
Joined: Tue Dec 20, 2005 7:36 pm
Location: São Paulo - Brasil

Re: SetPrintDefault no funciona en Windows 10

Postby AngelSalom » Tue Oct 04, 2016 3:50 pm

Magnífico karinha, sustituyendo SetPrintDefault por SetDefaultPrinter se solucionó.
Angel Salom
Visionwin Software - https://www.visionwin.com
------------------------------------------------------------
fwh 19.05 - harbour 3.2 - bcc 7.4
User avatar
AngelSalom
 
Posts: 708
Joined: Fri Oct 07, 2005 7:38 am
Location: Benicarló (Castellón ) - España


Return to FiveWin para Harbour/xHarbour

Who is online

Users browsing this forum: Google [Bot] and 61 guests