FiveTech Support Forums

FiveWin / Harbour / xBase community
Board index FiveWin para Harbour/xHarbour SetDefaultPrinter() No funciona más?
Posts: 8523
Joined: Tue Dec 20, 2005 07:36 PM

SetDefaultPrinter() No funciona más?

Posted: Thu Jan 16, 2014 12:41 PM
Maestro, tengo que mantener la impresora seleccionada como predeterminada, pero el comando no funciona.

Code (fw): Select all Collapse
FUNCTION DefaultPrinter()

   // Abre a tela para a seleção da impressora
   GetPrintDC( GetActiveWindow() )

   // Coloca a impressora selecionada como Default do Windows
   SetDefaultPrinter( PRNGETNAME() )  // No funciona... Que hacer?

RETURN NIL


FWH13.06

Saludos.
João Santos - São Paulo - Brasil - Phone: +55(11)95150-7341
Posts: 8523
Joined: Tue Dec 20, 2005 07:36 PM

Re: SetDefaultPrinter() No funciona más?

Posted: Thu Jan 16, 2014 02:05 PM
problema resuelto:

Code (fw): Select all Collapse
METHOD New( cDocument, lUser, lPreview, cModel, lModal, lSelection, cFile ) CLASS TPrinter

   local aOffset
   local cPrinter

   DEFAULT cDocument  := "FiveWin Report" ,;
       lUser := .f., lPreview := .f., lModal := .f., lSelection := .f.

   if lUser

      ::hDC := GetPrintDC( GetActiveWindow(), lSelection, PrnGetPagNums() )

      if ::hDC != 0
         cModel = ::GetModel() + "," + ::GetDriver() + "," + ::GetPort()
      endif

   elseif cModel == nil  // Modified: 16/01/2014

      ::hDC  := GetPrintDefault( GetActiveWindow() )

      cModel = ::GetModel() + "," + ::GetDriver() + "," + ::GetPort()

      SetPrintDefault( cModel ) // NEW !!!  // 16/01/2014  Joao

   else

      cPrinter := GetProfString( "windows", "device" , "" )

      WriteProfString( "windows", "device", cModel )

      SysRefresh()

      PrinterInit()

      ::hDC := GetPrintDefault( GetActiveWindow() )

      SysRefresh()

      WriteProfString( "windows", "device", cPrinter  )

      SetPrintDefault( cPrinter ) // NEW !!!  Antonio Linares

   endif
João Santos - São Paulo - Brasil - Phone: +55(11)95150-7341

Continue the discussion