FiveTech Support Forums

FiveWin / Harbour / xBase community
Board index FiveWin for Harbour/xHarbour FWH 13:09 Default Printer
Posts: 44158
Joined: Thu Oct 06, 2005 05:47 PM
Re: FWH 13:08 Default Printer
Posted: Tue Oct 08, 2013 02:20 PM

Oscar,

I also need this, please:

MsgInfo( GETPROFSTRING( "Devices", cModel, "" ) )

regards, saludos

Antonio Linares
www.fivetechsoft.com
Posts: 44158
Joined: Thu Oct 06, 2005 05:47 PM
Re: FWH 13:08 Default Printer
Posted: Tue Oct 08, 2013 02:22 PM
Oscar,

This way:
Code (fw): Select all Collapse
  elseif cModel == nil
      cModel = ::GetModel() + "," + ::GetDriver() + "," + ::GetPort()
      MsgInfo( GETPROFSTRING( "Devices", cModel, "" ) )
      ::hDC := PRINTERDCFROMNAME( STRTOKEN( GETPROFSTRING( "Devices", cModel, "" ), 1, "," ), cModel, STRTOKEN( GETPROFSTRING( "Devices", cModel, "" ), 2, "," ) )
regards, saludos

Antonio Linares
www.fivetechsoft.com
Posts: 187
Joined: Mon Oct 20, 2008 06:33 PM
Re: FWH 13:08 Default Printer
Posted: Tue Oct 08, 2013 05:19 PM

With:
cModel = ::GetModel() + "," + ::GetDriver() + "," + ::GetPort()
MsgInfo( GETPROFSTRING( "Devices", cModel, "" ) )

The result is blank. Returns nothing.

Oscar Ribeiro

OASyS Informática

Fwh18.02 + xHarbour 1.2.3 + Bcc72
Posts: 44158
Joined: Thu Oct 06, 2005 05:47 PM
Re: FWH 13:08 Default Printer
Posted: Wed Oct 09, 2013 07:45 AM
Oscar,

This is the current code for that else:
Code (fw): Select all Collapse
      ::hDC := GetPrintDefault( GetActiveWindow() )
      if ::hDC != 0
         cModel = ::GetModel() + "," + ::GetDriver() + "," + ::GetPort()
      endif


That should work for you, though you say that the selected printer does not remain selected all the app execution ?
regards, saludos

Antonio Linares
www.fivetechsoft.com
Posts: 187
Joined: Mon Oct 20, 2008 06:33 PM
Re: FWH 13:08 Default Printer
Posted: Wed Oct 09, 2013 10:47 AM

Linares,

I'll try my users adapt to this new reality.

But the ideal is that the system working again as before, as Windows programs work. For example, the MS-Word. When you open a document and before printing, change the printer destination, every impression of MS-Word will come out this new printer, even if you open other documents, printing will be directed to this same printer as MS-Word is open. Without affecting in any way the standard printer control panel of Windows. That's how programs Fivewin for Windows should work.

Please do this test in MS-Word.

Thanks,

Oscar Ribeiro

OASyS Informática

Fwh18.02 + xHarbour 1.2.3 + Bcc72
Posts: 44158
Joined: Thu Oct 06, 2005 05:47 PM
Re: FWH 13:08 Default Printer
Posted: Wed Oct 09, 2013 12:54 PM

Oscar,

Where are you selecting the target printer ? From the preview itself ?

regards, saludos

Antonio Linares
www.fivetechsoft.com
Posts: 187
Joined: Mon Oct 20, 2008 06:33 PM
Re: FWH 13:08 Default Printer
Posted: Wed Oct 09, 2013 01:19 PM

Linares,

We select one of two ways:

In the menu system using the command:
GetPrintDC (GetActiveWindow ())

Or before printing with the command:
PRINTERSETUP ()

Thanks,

Oscar Ribeiro

OASyS Informática

Fwh18.02 + xHarbour 1.2.3 + Bcc72
Posts: 44158
Joined: Thu Oct 06, 2005 05:47 PM
Re: FWH 13:08 Default Printer
Posted: Wed Oct 09, 2013 01:36 PM
Here there is some code that may help for what you are looking for:

https://www.powerbasic.com/support/pbforums/showthread.php?t=15204

We need to migrate it to FWH
regards, saludos

Antonio Linares
www.fivetechsoft.com
Posts: 187
Joined: Mon Oct 20, 2008 06:33 PM
Re: FWH 13:08 Default Printer
Posted: Wed Oct 09, 2013 03:49 PM

Yes. This is the way.

Oscar Ribeiro

OASyS Informática

Fwh18.02 + xHarbour 1.2.3 + Bcc72
Posts: 842
Joined: Mon Oct 10, 2005 01:29 PM
Re: FWH 13:08 Default Printer
Posted: Wed Oct 09, 2013 04:06 PM

I do not know if this can help

viewtopic.php?f=3t=27371

Maurizio

www.nipeservice.com

&

Posts: 44158
Joined: Thu Oct 06, 2005 05:47 PM
Re: FWH 13:08 Default Printer
Posted: Wed Oct 09, 2013 06:45 PM

Maurizio,

Thanks for your help. What Oscar is looking for is to set a default printer from our apps that remains selected all the app execution time and does not modify the WIndows default printer.

regards, saludos

Antonio Linares
www.fivetechsoft.com
Posts: 824
Joined: Thu Oct 13, 2005 07:39 AM
Re: FWH 13:08 Default Printer
Posted: Thu Oct 10, 2013 07:06 AM
Oscar,

why don´t you use the TO <cPrinter> clause ?
Code (fw): Select all Collapse
PRINT oPrn TO <cPrinterName>


1: get all printers with GetPrinters() (function from xHarbour) or any other function.
2: select the desired printer and save it in a global var or in an ini-file.
3: use always the TO clause (PRINT...TO, REPORT...TO, etc)

That does not affect the windows default printer and is working fine. I always use this technic and I never had problems
kind regards

Stefan
Posts: 44158
Joined: Thu Oct 06, 2005 05:47 PM
Re: FWH 13:08 Default Printer
Posted: Fri Oct 11, 2013 07:44 AM

Stefan,

Very good, many thanks

Many times we miss the simplest way to do things :-)

regards, saludos

Antonio Linares
www.fivetechsoft.com
Posts: 187
Joined: Mon Oct 20, 2008 06:33 PM
Re: FWH 13:08 Default Printer
Posted: Wed Nov 13, 2013 11:44 AM
Linares,

I'm with version FWH 13:09 Revision 2 and the selected printer is not getting active throughout the program. Should I make any changes in the source?

Thanks,

Code (fw): Select all Collapse
* Enhancement: Class TPrinter Method New() has been improved so the selected printer (default printer) remains the same all the app life. Thanks to Enrico!
viewtopic.php?p=152663#p152663
Oscar Ribeiro

OASyS Informática

Fwh18.02 + xHarbour 1.2.3 + Bcc72
Posts: 1516
Joined: Thu May 27, 2010 02:06 PM
Re: FWH 13:09 Default Printer
Posted: Wed Nov 13, 2013 02:01 PM