FWH 13:09 Default Printer

User avatar
Antonio Linares
Site Admin
Posts: 37481
Joined: Thu Oct 06, 2005 5:47 pm
Location: Spain
Contact:

Re: FWH 13:08 Default Printer

Post by Antonio Linares »

_,

I also need this, please:

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

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

Re: FWH 13:08 Default Printer

Post by Antonio Linares »

_,

This way:

Code: Select all

  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
User avatar
ORibeiro
Posts: 174
Joined: Mon Oct 20, 2008 6:33 pm
Location: Itu, Sao Paulo, Brazil

Re: FWH 13:08 Default Printer

Post by ORibeiro »

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

The result is blank. Returns nothing.
_ Ribeiro
OASyS Informática
Fwh18.02 + xHarbour 1.2.3 + Bcc72
User avatar
Antonio Linares
Site Admin
Posts: 37481
Joined: Thu Oct 06, 2005 5:47 pm
Location: Spain
Contact:

Re: FWH 13:08 Default Printer

Post by Antonio Linares »

_,

This is the current code for that else:

Code: Select all

      ::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
User avatar
ORibeiro
Posts: 174
Joined: Mon Oct 20, 2008 6:33 pm
Location: Itu, Sao Paulo, Brazil

Re: FWH 13:08 Default Printer

Post by ORibeiro »

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,
_ Ribeiro
OASyS Informática
Fwh18.02 + xHarbour 1.2.3 + Bcc72
User avatar
Antonio Linares
Site Admin
Posts: 37481
Joined: Thu Oct 06, 2005 5:47 pm
Location: Spain
Contact:

Re: FWH 13:08 Default Printer

Post by Antonio Linares »

_,

Where are you selecting the target printer ? From the preview itself ?
regards, saludos

Antonio Linares
www.fivetechsoft.com
User avatar
ORibeiro
Posts: 174
Joined: Mon Oct 20, 2008 6:33 pm
Location: Itu, Sao Paulo, Brazil

Re: FWH 13:08 Default Printer

Post by ORibeiro »

Linares,

We select one of two ways:

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

Or before printing with the command:
PRINTERSETUP ()

Thanks,
_ Ribeiro
OASyS Informática
Fwh18.02 + xHarbour 1.2.3 + Bcc72
User avatar
Antonio Linares
Site Admin
Posts: 37481
Joined: Thu Oct 06, 2005 5:47 pm
Location: Spain
Contact:

Re: FWH 13:08 Default Printer

Post by Antonio Linares »

Here there is some code that may help for what you are looking for:

https://www.powerbasic.com/support/pbfo ... hp?t=15204

We need to migrate it to FWH
regards, saludos

Antonio Linares
www.fivetechsoft.com
User avatar
ORibeiro
Posts: 174
Joined: Mon Oct 20, 2008 6:33 pm
Location: Itu, Sao Paulo, Brazil

Re: FWH 13:08 Default Printer

Post by ORibeiro »

Yes. This is the way.
_ Ribeiro
OASyS Informática
Fwh18.02 + xHarbour 1.2.3 + Bcc72
User avatar
Maurizio
Posts: 705
Joined: Mon Oct 10, 2005 1:29 pm
Contact:

Re: FWH 13:08 Default Printer

Post by Maurizio »

User avatar
Antonio Linares
Site Admin
Posts: 37481
Joined: Thu Oct 06, 2005 5:47 pm
Location: Spain
Contact:

Re: FWH 13:08 Default Printer

Post by Antonio Linares »

Maurizio,

Thanks for your help. What _ 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
StefanHaupt
Posts: 824
Joined: Thu Oct 13, 2005 7:39 am
Location: Germany

Re: FWH 13:08 Default Printer

Post by StefanHaupt »

_,

why don´t you use the TO <cPrinter> clause ?

Code: Select all

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
User avatar
Antonio Linares
Site Admin
Posts: 37481
Joined: Thu Oct 06, 2005 5:47 pm
Location: Spain
Contact:

Re: FWH 13:08 Default Printer

Post by Antonio Linares »

Stefan,

Very good, many thanks

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

Antonio Linares
www.fivetechsoft.com
User avatar
ORibeiro
Posts: 174
Joined: Mon Oct 20, 2008 6:33 pm
Location: Itu, Sao Paulo, Brazil

Re: FWH 13:08 Default Printer

Post by ORibeiro »

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: Select all

* 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
 
_ Ribeiro
OASyS Informática
Fwh18.02 + xHarbour 1.2.3 + Bcc72
Post Reply