FWH 13:09 Default Printer
Re: FWH 13:09 Default Printer
Problem 1:
- Sorry, but I did not understand what I do to preserve the printer that was selected.
Problem 2:
- Another problem is that the view factor is not working and the magnifying glass distorts the image on a widescreen monitor.
Problem 3:
- If I change the printer button that makes it into the viewer, it does not print after.
- Sorry, but I did not understand what I do to preserve the printer that was selected.
Problem 2:
- Another problem is that the view factor is not working and the magnifying glass distorts the image on a widescreen monitor.
Problem 3:
- If I change the printer button that makes it into the viewer, it does not print after.
_ Ribeiro
OASyS Informática
Fwh18.02 + xHarbour 1.2.3 + Bcc72
OASyS Informática
Fwh18.02 + xHarbour 1.2.3 + Bcc72
- James Bott
- Posts: 4654
- Joined: Fri Nov 18, 2005 4:52 pm
- Location: San Diego, California, USA
- Contact:
Re: FWH 13:09 Default Printer
Just to clarify standard Windows printer behavior.
I have not read this entire thread, so some of this may have already been mentioned. It took me some time to figure this all out by trial and error.
The "windows default printer" is selected automatically by any app when it opens and also remains the selected printer unless it it is changed within the app.
If an app selects a printer, it is then used within that app until the app is closed. This selection does not affect any other apps. And it does not affect the windows default printer. Of course, an app could override this behavior by saving and restoring it's own printer selections. This may or may not be advisable. I have used this occasionally when different reports needed to be sent to different printers (within the same app).
It is possible to change the windows default printer from within an app, but I would suggest never doing it. Doing so would mess up all other apps that are relying on the windows default printer (that was set via the Windows printer-setup routine).
You could provide the user the option to save the selected printer for use only within that app. Just save the printer model in a config file, then restore it whenever the program is run.
So, _, if your app is loosing the selected printer, it would seem that FWH/(x)Harbour is doing it and it is not the Windows standard.
Regards,
James
I have not read this entire thread, so some of this may have already been mentioned. It took me some time to figure this all out by trial and error.
The "windows default printer" is selected automatically by any app when it opens and also remains the selected printer unless it it is changed within the app.
If an app selects a printer, it is then used within that app until the app is closed. This selection does not affect any other apps. And it does not affect the windows default printer. Of course, an app could override this behavior by saving and restoring it's own printer selections. This may or may not be advisable. I have used this occasionally when different reports needed to be sent to different printers (within the same app).
It is possible to change the windows default printer from within an app, but I would suggest never doing it. Doing so would mess up all other apps that are relying on the windows default printer (that was set via the Windows printer-setup routine).
You could provide the user the option to save the selected printer for use only within that app. Just save the printer model in a config file, then restore it whenever the program is run.
So, _, if your app is loosing the selected printer, it would seem that FWH/(x)Harbour is doing it and it is not the Windows standard.
Regards,
James
Re: FWH 13:09 Default Printer
James,
Thanks for your reply.
Before migrating to FWH13.08, I used the fwh12.07 and once selected a printer that is different from the standard Windows ward stood just inside the selected application and while it was open.
Now my system does not do that anymore and each report the user needs to select the printer again. This has caused me numerous complaints from my clients.
It seems to me that the Linares FWH13.09 resolved it in but I did not understand what should I change in my programs.
I await.
Thanks for your reply.
Before migrating to FWH13.08, I used the fwh12.07 and once selected a printer that is different from the standard Windows ward stood just inside the selected application and while it was open.
Now my system does not do that anymore and each report the user needs to select the printer again. This has caused me numerous complaints from my clients.
It seems to me that the Linares FWH13.09 resolved it in but I did not understand what should I change in my programs.
I await.
_ Ribeiro
OASyS Informática
Fwh18.02 + xHarbour 1.2.3 + Bcc72
OASyS Informática
Fwh18.02 + xHarbour 1.2.3 + Bcc72
- James Bott
- Posts: 4654
- Joined: Fri Nov 18, 2005 4:52 pm
- Location: San Diego, California, USA
- Contact:
Re: FWH 13:08 Default Printer
_,
As was mentioned earlier in this message thread, in the FWH source program PRINTER.PRG find the METHOD NEW() and in this method replace the code as shown below. Then compile the changed program and link it into your program.
Regards,
James
As was mentioned earlier in this message thread, in the FWH source program PRINTER.PRG find the METHOD NEW() and in this method replace the code as shown below. Then compile the changed program and link it into your program.
Regards,
James
Enrico Maria Giordano wrote:Antonio,
Yes, my friend.Antonio Linares wrote:Enrico,
Do you mean that you have replaced:with:Code: Select all
else cPrinter := GetProfString( "windows", "device" , "" ) WriteProfString( "windows", "device", cModel ) SysRefresh() PrinterInit() ::hDC := GetPrintDefault( GetActiveWindow() ) SysRefresh() WriteProfString( "windows", "device", cPrinter ) SetPrintDefault( cPrinter ) // NEW !!! endif
thanksCode: Select all
else ::hDC = PRINTERDCFROMNAME( STRTOKEN( GETPROFSTRING( "Devices", cModel, "" ), 1, "," ), cModel, STRTOKEN( GETPROFSTRING( "Devices", cModel, "" ), 2, "," ) ) endif
EMG
- Antonio Linares
- Site Admin
- Posts: 37481
- Joined: Thu Oct 06, 2005 5:47 pm
- Location: Spain
- Contact:
Re: FWH 13:09 Default Printer
This is the current source code once fixed:
Code: Select all
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
::hDC = PrinterDcFromName( , cModel, )
endif
Re: FWH 13:09 Default Printer
Unfortunately, neither of the two alternatives work.
The "MsgInfo(CModel)" shows the printer selected by the user but prints to another printer that is default in Windows.
Change 1:
Change 2:
The "MsgInfo(CModel)" shows the printer selected by the user but prints to another printer that is default in Windows.
Change 1:
Code: Select all
else
msginfo( cModel )
::hDC = PrinterDcFromName( , cModel, )
endif
Code: Select all
else
msginfo( cModel )
::hDC = PRINTERDCFROMNAME( STRTOKEN( GETPROFSTRING( "Devices", cModel, "" ), 1, "," ), cModel, STRTOKEN( GETPROFSTRING( "Devices", cModel, "" ), 2, "," ) )
endif
_ Ribeiro
OASyS Informática
Fwh18.02 + xHarbour 1.2.3 + Bcc72
OASyS Informática
Fwh18.02 + xHarbour 1.2.3 + Bcc72
Re: FWH 13:09 Default Printer
The function for the user to select a new printer and change cModel is:
Then I inform cModel to print with:
PRINT ... TO cModel
Code: Select all
Static Function oaPrinterSetup() // Sem essa função, o FWH respeita a seleção apenas para o próximo relatório, voltando depois para o padrão do Windows.
GetPrintDC( GetActiveWindow() ) // Abre a tela para a seleção da impressora
cModel := PrnGetName() // Grava a última impressora selecionada pelo usuário
Return nil
PRINT ... TO cModel
_ Ribeiro
OASyS Informática
Fwh18.02 + xHarbour 1.2.3 + Bcc72
OASyS Informática
Fwh18.02 + xHarbour 1.2.3 + Bcc72
- Enrico Maria Giordano
- Posts: 7355
- Joined: Thu Oct 06, 2005 8:17 pm
- Location: Roma - Italia
- Contact:
Re: FWH 13:09 Default Printer
I fixed PrinterDcFromName() function last year (if I remember correctly). Maybe your FWH version doesn't contain the fix.ORibeiro wrote:Unfortunately, neither of the two alternatives work.
The "MsgInfo(CModel)" shows the printer selected by the user but prints to another printer that is default in Windows.
EMG
Re: FWH 13:09 Default Printer
Mu Fwh is the last one.
Fwh13.09 rev2 don't have this fix?
Fwh13.09 rev2 don't have this fix?
_ Ribeiro
OASyS Informática
Fwh18.02 + xHarbour 1.2.3 + Bcc72
OASyS Informática
Fwh18.02 + xHarbour 1.2.3 + Bcc72
- Enrico Maria Giordano
- Posts: 7355
- Joined: Thu Oct 06, 2005 8:17 pm
- Location: Roma - Italia
- Contact:
Re: FWH 13:09 Default Printer
Yes, it has, of course.ORibeiro wrote:Mu Fwh is the last one.
Fwh13.09 rev2 don't have this fix?
EMG
- Antonio Linares
- Site Admin
- Posts: 37481
- Joined: Thu Oct 06, 2005 5:47 pm
- Location: Spain
- Contact:
Re: FWH 13:09 Default Printer
_,
Here it is working fine using ::hDC = PrinterDcFromName( , cModel, )
Have you checked the valur of ::hDC after such line ?
Here it is working fine using ::hDC = PrinterDcFromName( , cModel, )
Have you checked the valur of ::hDC after such line ?
Re: FWH 13:09 Default Printer
The :hDC show me a number and prints to the "default printer on the windows" and not in the selected by the user.
_ Ribeiro
OASyS Informática
Fwh18.02 + xHarbour 1.2.3 + Bcc72
OASyS Informática
Fwh18.02 + xHarbour 1.2.3 + Bcc72
- Antonio Linares
- Site Admin
- Posts: 37481
- Joined: Thu Oct 06, 2005 5:47 pm
- Location: Spain
- Contact:
Re: FWH 13:09 Default Printer
What value has cModel ?
And what do you get for GetProfString( "Devices" ) ?
And what do you get for GetProfString( "Devices" ) ?
Re: FWH 13:09 Default Printer
Default Printer in Windows = PDF reDirect V2
Selected Printer by User = \\OASYS4\Samsung SCX-4200 Series
After ::hDC = PrinterDcFromName( , cModel, )
MsgInfo( cModel ) = \\OASYS4\Samsung SCX-4200 Series
MsgInfo( GetProfString("Device") ) = CutePDF Writer
Only the first time after the user selects the printer is that the report is printed in \\OASYS4\Samsung SCX-4200 Series, the next reports are printed on PDF reDirect V2.
Selected Printer by User = \\OASYS4\Samsung SCX-4200 Series
After ::hDC = PrinterDcFromName( , cModel, )
MsgInfo( cModel ) = \\OASYS4\Samsung SCX-4200 Series
MsgInfo( GetProfString("Device") ) = CutePDF Writer
Only the first time after the user selects the printer is that the report is printed in \\OASYS4\Samsung SCX-4200 Series, the next reports are printed on PDF reDirect V2.
_ Ribeiro
OASyS Informática
Fwh18.02 + xHarbour 1.2.3 + Bcc72
OASyS Informática
Fwh18.02 + xHarbour 1.2.3 + Bcc72
- James Bott
- Posts: 4654
- Joined: Fri Nov 18, 2005 4:52 pm
- Location: San Diego, California, USA
- Contact:
Re: FWH 13:09 Default Printer
_,
May I suggest a simple test program. First call printerSetup() so the user can select a printer. Then print a report (without passing a printer name). Then print the same report again (also without passing a printer name). Both reports should go to the same printer--the one the user selected. Make the test program as small as possible.
Let us know the results. And post the sample program code.
Regards,
James
May I suggest a simple test program. First call printerSetup() so the user can select a printer. Then print a report (without passing a printer name). Then print the same report again (also without passing a printer name). Both reports should go to the same printer--the one the user selected. Make the test program as small as possible.
Let us know the results. And post the sample program code.
Regards,
James