Page 2 of 5

Re: FWH 13:08 Default Printer

PostPosted: Tue Oct 08, 2013 2:20 pm
by Antonio Linares
Oscar,

I also need this, please:

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

Re: FWH 13:08 Default Printer

PostPosted: Tue Oct 08, 2013 2:22 pm
by Antonio Linares
Oscar,

This way:
Code: Select all  Expand view

  elseif cModel == nil
      cModel = ::GetModel() + "," + ::GetDriver() + "," + ::GetPort()
      MsgInfo( GETPROFSTRING( "Devices", cModel, "" ) )
      ::hDC := PRINTERDCFROMNAME( STRTOKEN( GETPROFSTRING( "Devices", cModel, "" ), 1, "," ), cModel, STRTOKEN( GETPROFSTRING( "Devices", cModel, "" ), 2, "," ) )

Re: FWH 13:08 Default Printer

PostPosted: Tue Oct 08, 2013 5:19 pm
by ORibeiro
With:
cModel = ::GetModel() + "," + ::GetDriver() + "," + ::GetPort()
MsgInfo( GETPROFSTRING( "Devices", cModel, "" ) )

The result is blank. Returns nothing.

Re: FWH 13:08 Default Printer

PostPosted: Wed Oct 09, 2013 7:45 am
by Antonio Linares
Oscar,

This is the current code for that else:
Code: Select all  Expand view

      ::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 ?

Re: FWH 13:08 Default Printer

PostPosted: Wed Oct 09, 2013 10:47 am
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,

Re: FWH 13:08 Default Printer

PostPosted: Wed Oct 09, 2013 12:54 pm
by Antonio Linares
Oscar,

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

Re: FWH 13:08 Default Printer

PostPosted: Wed Oct 09, 2013 1:19 pm
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,

Re: FWH 13:08 Default Printer

PostPosted: Wed Oct 09, 2013 1:36 pm
by Antonio Linares
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

Re: FWH 13:08 Default Printer

PostPosted: Wed Oct 09, 2013 3:49 pm
by ORibeiro
Yes. This is the way.

Re: FWH 13:08 Default Printer

PostPosted: Wed Oct 09, 2013 4:06 pm
by Maurizio
I do not know if this can help

viewtopic.php?f=3&t=27371

Maurizio
www.nipeservice.com

Re: FWH 13:08 Default Printer

PostPosted: Wed Oct 09, 2013 6:45 pm
by Antonio Linares
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.

Re: FWH 13:08 Default Printer

PostPosted: Thu Oct 10, 2013 7:06 am
by StefanHaupt
Oscar,

why don´t you use the TO <cPrinter> clause ?
Code: Select all  Expand view
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

Re: FWH 13:08 Default Printer

PostPosted: Fri Oct 11, 2013 7:44 am
by Antonio Linares
Stefan,

Very good, many thanks

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

Re: FWH 13:08 Default Printer

PostPosted: Wed Nov 13, 2013 11:44 am
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  Expand view

* 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
 

Re: FWH 13:09 Default Printer

PostPosted: Wed Nov 13, 2013 2:01 pm
by mastintin