FiveTech Support Forums

FiveWin / Harbour / xBase community
Board index FiveWin for Harbour/xHarbour Printing files
Posts: 113
Joined: Wed Feb 08, 2006 10:32 PM
Printing files
Posted: Fri Mar 03, 2006 07:26 PM

I know it is possible to print a file using ShellExecute() but it prints to the default printer.
There is a way to redirect the print to another printer ?
I need to print various types of files to a specified printer (doc rtf pdf ecc.)

Roberto Chiaiese
R&C Informatica S.n.c.
https://www.recinformatica.it
info@recinformatica.it

Harbour 3.2 - FW2512

Posts: 9020
Joined: Thu Oct 06, 2005 08:17 PM
Re: Printing files
Posted: Fri Mar 03, 2006 08:17 PM

Use SetPrintDefault() function just before calling ShellExecute().

EMG

Posts: 113
Joined: Wed Feb 08, 2006 10:32 PM
Printing files
Posted: Sat Mar 04, 2006 02:30 PM

Enrico,
thanks for your answer

however I have found this other way that is simpler than setting and then restoring the default printer:

ShellExecute(0,"PrintTo",cMyDocument,"PDFCreator",0,1)

Roberto

Roberto Chiaiese
R&C Informatica S.n.c.
https://www.recinformatica.it
info@recinformatica.it

Harbour 3.2 - FW2512

Posts: 9020
Joined: Thu Oct 06, 2005 08:17 PM
Posts: 113
Joined: Wed Feb 08, 2006 10:32 PM
Printing files
Posted: Sun Mar 05, 2006 05:28 PM

On one PC only I have this problem:

though I have set wordpad as the standard app to open rtf files, when I issue the ShellExecute(0,"PrintTo",cMyDoc,cMyPrinter0,0) statement, the document is printed using MsWord
If I double-click the rtf file, then WordPad is used
Normally the application used to open the file is the same that is used to print it. How can I force printing using WordPad ?

Roberto

Roberto Chiaiese
R&C Informatica S.n.c.
https://www.recinformatica.it
info@recinformatica.it

Harbour 3.2 - FW2512

Posts: 9020
Joined: Thu Oct 06, 2005 08:17 PM
Printing files
Posted: Sun Mar 05, 2006 05:46 PM

Check the properties of the RTF extension association. Specifically, look inside Open method. Try to compare it with those of a working PC.

EMG

Posts: 113
Joined: Wed Feb 08, 2006 10:32 PM
Printing files
Posted: Mon Mar 06, 2006 08:38 AM

do you mean by right-clicking the file, or something else in the windows registry (or INI file) ?

Roberto Chiaiese
R&C Informatica S.n.c.
https://www.recinformatica.it
info@recinformatica.it

Harbour 3.2 - FW2512

Posts: 9020
Joined: Thu Oct 06, 2005 08:17 PM
Printing files
Posted: Mon Mar 06, 2006 10:38 AM

No, Tools -> Folder options -> File types (Strumenti -> Opzioni cartella -> Tipi di file in Italian).

EMG

Posts: 233
Joined: Sat Dec 30, 2006 06:10 AM
Printing files
Posted: Thu Mar 13, 2008 03:02 PM

ShellExecute(0,"PrintTo",cMyDocument,"MyPrinter",0,1)

works well, but it prompts the user to select the printer. Is there a way to just print directly with out the PrintSetup screen?

Many thanks

Ollie.



Using:

xHarbour Compiler build 1.2.1 (SimpLex) (Rev. 6406)

Borland C++ 5.5.1

FWH 9.04 (2009 Apr)
Posts: 113
Joined: Wed Feb 08, 2006 10:32 PM
Printing files
Posted: Mon Mar 17, 2008 08:18 AM

It should not prompt the user.
Check for the correct printer name as you find it in the printer folder

regards
Roberto

Roberto Chiaiese
R&C Informatica S.n.c.
https://www.recinformatica.it
info@recinformatica.it

Harbour 3.2 - FW2512

Posts: 233
Joined: Sat Dec 30, 2006 06:10 AM
Printing files
Posted: Fri Mar 28, 2008 03:03 PM

It definitely prompts the user.

I even tried:

     ShellExecute( 0, "PrintTo", cHTMOut, PrnGetName() , 0, 1 )

? PrnGetName()
reports the correct name.

Many thanks

Ollie.



Using:

xHarbour Compiler build 1.2.1 (SimpLex) (Rev. 6406)

Borland C++ 5.5.1

FWH 9.04 (2009 Apr)

Continue the discussion