FWH 13:09 Default Printer

FWH 13:09 Default Printer

Postby ORibeiro » Thu Oct 03, 2013 12:23 pm

Linares,

I'm having a lot of complaints from my clients because in the version I was using the FWH the user selected a printer and it kept while he was inside the system, but now the printer selected is valid just for the next printing. Is necessary to select again each print.

Is there anything I can do to make the FWH back to work as before?
Last edited by ORibeiro on Wed Nov 13, 2013 11:46 am, edited 1 time in total.
Oscar Ribeiro
OASyS Informática
Fwh18.02 + xHarbour 1.2.3 + Bcc72
User avatar
ORibeiro
 
Posts: 187
Joined: Mon Oct 20, 2008 6:33 pm
Location: Itu, Sao Paulo, Brazil

Re: FWH 13:08 Default Printer

Postby kok joek hoa » Thu Oct 03, 2013 7:48 pm

HI ORibeiro,

Yes, I confirm this problem.

So I change my code like this :



coldprinter := prnGetName() // default printer


WriteProfString( "windows", "device",cnewprinter) // change to new printer
SetPrintDefault(cnewprinter)
PrinterInit()
SysRefresh()

....
.....

// change to default printer

WriteProfString( "windows", "device",coldprinter) // default printer
SetPrintDefault(coldprinter)
PrinterInit()
SysRefresh()

regards,

Kok
kok joek hoa
 
Posts: 117
Joined: Tue Jan 03, 2006 6:18 pm

Re: FWH 13:08 Default Printer

Postby ORibeiro » Sat Oct 05, 2013 1:53 am

Kok,

Thanks for your reply.

The problem with SetDefaultPrinter() function "for my use" is that my clients use my programs within Windows Server and Terminal Server with the same user, for example, the user "SALES" is used by 10 vendors and in this case, when a change the default printer in Windows, switches to all others.
 
I need to let the default printer only within the program (such as FWH worked before) and not on Windows printers.

If I find out what the command line of the new FiveWin that returns to the system's default printer windows when closing the report I disable this line and problem solved!
 
Does anyone know what is that line?
Oscar Ribeiro
OASyS Informática
Fwh18.02 + xHarbour 1.2.3 + Bcc72
User avatar
ORibeiro
 
Posts: 187
Joined: Mon Oct 20, 2008 6:33 pm
Location: Itu, Sao Paulo, Brazil

Re: FWH 13:08 Default Printer

Postby Antonio Linares » Mon Oct 07, 2013 9:27 am

Oscar,

> Does anyone know what is that line?

What line do you mean ? Please copy it here, thanks
regards, saludos

Antonio Linares
www.fivetechsoft.com
User avatar
Antonio Linares
Site Admin
 
Posts: 42118
Joined: Thu Oct 06, 2005 5:47 pm
Location: Spain

Re: FWH 13:08 Default Printer

Postby ORibeiro » Mon Oct 07, 2013 10:19 am

Linares,

Thank you for your interest in helping me.

I need to know when the Fivewin causes the printer system is equal to the windows after the printing. It is this function (lines) that I need to cancel in my system, so that the printer selected by the user to keep active while the system is open.
Oscar Ribeiro
OASyS Informática
Fwh18.02 + xHarbour 1.2.3 + Bcc72
User avatar
ORibeiro
 
Posts: 187
Joined: Mon Oct 20, 2008 6:33 pm
Location: Itu, Sao Paulo, Brazil

Re: FWH 13:08 Default Printer

Postby Antonio Linares » Mon Oct 07, 2013 10:39 am

Please try to use the proposed change by Kok, thanks:

Code: Select all  Expand view  RUN
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
      ::hDC  := GetPrintDefault( GetActiveWindow() )
      if ::hDC != 0
         cModel = ::GetModel() + "," + ::GetDriver() + "," + ::GetPort()
      endif
   else
      cPrinter := GetProfString( "windows", "device" , "" )
      WriteProfString( "windows", "device", cModel )
      SysRefresh()
      PrinterInit()
      ::hDC := GetPrintDefault( GetActiveWindow() )
      SysRefresh()
      WriteProfString( "windows", "device", cPrinter  )
      SetPrintDefault( cPrinter ) // NEW !!!
   endif

   ...
 
regards, saludos

Antonio Linares
www.fivetechsoft.com
User avatar
Antonio Linares
Site Admin
 
Posts: 42118
Joined: Thu Oct 06, 2005 5:47 pm
Location: Spain

Re: FWH 13:08 Default Printer

Postby ORibeiro » Mon Oct 07, 2013 11:00 am

Linares,

I did it.

However, I use Windows Server with Terminal Server with the same user TS is connected simultaneously by multiple people. By using command "SetPrintDefault( cPrinter )" the person changes the default printer in windows for all others who are using the same user.

So I can not use the "SetPrintDefault( cPrinter )".

I need to keep the selected printer only within the program open, without changing the Windows default printer.
Oscar Ribeiro
OASyS Informática
Fwh18.02 + xHarbour 1.2.3 + Bcc72
User avatar
ORibeiro
 
Posts: 187
Joined: Mon Oct 20, 2008 6:33 pm
Location: Itu, Sao Paulo, Brazil

Re: FWH 13:08 Default Printer

Postby Enrico Maria Giordano » Mon Oct 07, 2013 11:10 am

Oscar,

this is what I'm using:

Code: Select all  Expand view  RUN
   else
      ::hDC = PRINTERDCFROMNAME( STRTOKEN( GETPROFSTRING( "Devices", cModel, "" ), 1, "," ), cModel, STRTOKEN( GETPROFSTRING( "Devices", cModel, "" ), 2, "," ) )
   endif

   ...
 


EMG
User avatar
Enrico Maria Giordano
 
Posts: 8718
Joined: Thu Oct 06, 2005 8:17 pm
Location: Roma - Italia

Re: FWH 13:08 Default Printer

Postby Antonio Linares » Mon Oct 07, 2013 11:13 am

Enrico,

Do you mean that you have replaced:
Code: Select all  Expand view  RUN
  else
      cPrinter := GetProfString( "windows", "device" , "" )
      WriteProfString( "windows", "device", cModel )
      SysRefresh()
      PrinterInit()
      ::hDC := GetPrintDefault( GetActiveWindow() )
      SysRefresh()
      WriteProfString( "windows", "device", cPrinter  )
      SetPrintDefault( cPrinter ) // NEW !!!
   endif


with:
Code: Select all  Expand view  RUN
  else
      ::hDC = PRINTERDCFROMNAME( STRTOKEN( GETPROFSTRING( "Devices", cModel, "" ), 1, "," ), cModel, STRTOKEN( GETPROFSTRING( "Devices", cModel, "" ), 2, "," ) )
   endif


thanks
regards, saludos

Antonio Linares
www.fivetechsoft.com
User avatar
Antonio Linares
Site Admin
 
Posts: 42118
Joined: Thu Oct 06, 2005 5:47 pm
Location: Spain

Re: FWH 13:08 Default Printer

Postby Enrico Maria Giordano » Mon Oct 07, 2013 11:24 am

Antonio,

Antonio Linares wrote:Enrico,

Do you mean that you have replaced:
Code: Select all  Expand view  RUN
  else
      cPrinter := GetProfString( "windows", "device" , "" )
      WriteProfString( "windows", "device", cModel )
      SysRefresh()
      PrinterInit()
      ::hDC := GetPrintDefault( GetActiveWindow() )
      SysRefresh()
      WriteProfString( "windows", "device", cPrinter  )
      SetPrintDefault( cPrinter ) // NEW !!!
   endif


with:
Code: Select all  Expand view  RUN
  else
      ::hDC = PRINTERDCFROMNAME( STRTOKEN( GETPROFSTRING( "Devices", cModel, "" ), 1, "," ), cModel, STRTOKEN( GETPROFSTRING( "Devices", cModel, "" ), 2, "," ) )
   endif


thanks


Yes, my friend. :-)

EMG
User avatar
Enrico Maria Giordano
 
Posts: 8718
Joined: Thu Oct 06, 2005 8:17 pm
Location: Roma - Italia

Re: FWH 13:08 Default Printer

Postby ORibeiro » Mon Oct 07, 2013 11:33 am

Eurico / Linares,

My program is processing this elseif...
Code: Select all  Expand view  RUN

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


So I changed this:
Code: Select all  Expand view  RUN

   elseif cModel == nil
//    ::hDC := GetPrintDefault( GetActiveWindow() )
      ::hDC := PRINTERDCFROMNAME( STRTOKEN( GETPROFSTRING( "Devices", cModel, "" ), 1, "," ), cModel, STRTOKEN( GETPROFSTRING( "Devices", cModel, "" ), 2, "," ) )
      if ::hDC != 0
         cModel = ::GetModel() + "," + ::GetDriver() + "," + ::GetPort()
      endif
 


The result was that he keeps the printer selected, as I will, but no longer opens a preview of the report.

We're almost there! Any ideas?
Oscar Ribeiro
OASyS Informática
Fwh18.02 + xHarbour 1.2.3 + Bcc72
User avatar
ORibeiro
 
Posts: 187
Joined: Mon Oct 20, 2008 6:33 pm
Location: Itu, Sao Paulo, Brazil

Re: FWH 13:08 Default Printer

Postby Antonio Linares » Mon Oct 07, 2013 8:50 pm

Oscar,

Try it this way:
Code: Select all  Expand view  RUN
  elseif cModel == nil
      cModel = ::GetModel() + "," + ::GetDriver() + "," + ::GetPort()
      ::hDC := PRINTERDCFROMNAME( STRTOKEN( GETPROFSTRING( "Devices", cModel, "" ), 1, "," ), cModel, STRTOKEN( GETPROFSTRING( "Devices", cModel, "" ), 2, "," ) )
 
regards, saludos

Antonio Linares
www.fivetechsoft.com
User avatar
Antonio Linares
Site Admin
 
Posts: 42118
Joined: Thu Oct 06, 2005 5:47 pm
Location: Spain

Re: FWH 13:08 Default Printer

Postby ORibeiro » Tue Oct 08, 2013 10:49 am

Linares,

I tried, but always returns zero in ::hdc and not print.

Another idea?
Oscar Ribeiro
OASyS Informática
Fwh18.02 + xHarbour 1.2.3 + Bcc72
User avatar
ORibeiro
 
Posts: 187
Joined: Mon Oct 20, 2008 6:33 pm
Location: Itu, Sao Paulo, Brazil

Re: FWH 13:08 Default Printer

Postby Antonio Linares » Tue Oct 08, 2013 12:06 pm

Oscar,

Please check whats the value for cModel:

...
cModel = ::GetModel() + "," + ::GetDriver() + "," + ::GetPort()
MsgInfo( cModel )
...
regards, saludos

Antonio Linares
www.fivetechsoft.com
User avatar
Antonio Linares
Site Admin
 
Posts: 42118
Joined: Thu Oct 06, 2005 5:47 pm
Location: Spain

Re: FWH 13:08 Default Printer

Postby ORibeiro » Tue Oct 08, 2013 1:40 pm

With PDF Printer:
PDF reDirect v2,winspool,PDF_REDIRECT_PORT:

With SAMSUNG Printer:
\\OASYS4\Samsung SCX-4200 Series,winspool,USB001

Thanks.
Oscar Ribeiro
OASyS Informática
Fwh18.02 + xHarbour 1.2.3 + Bcc72
User avatar
ORibeiro
 
Posts: 187
Joined: Mon Oct 20, 2008 6:33 pm
Location: Itu, Sao Paulo, Brazil

Next

Return to FiveWin for Harbour/xHarbour

Who is online

Users browsing this forum: No registered users and 90 guests