WLX: DefPrinter name on ListPrint()

Discuss and announce Total Commander plugins, addons and other useful tools here, both their usage and their development.

Moderators: Hacker, petermad, Stefan2, white

User avatar
tbeu
Power Member
Power Member
Posts: 1354
Joined: 2003-07-04, 07:52 UTC
Location: Germany
Contact:

WLX: DefPrinter name on ListPrint()

Post by *tbeu »

I have FreePDF installed and set as default printer. If I use the default printer for any lister plugin ListPrint() is called with DefPrinter = FreePDF. If I change the printer to any other printer in the Print setup of the lister and change it back to FreePDF then ListPrint() is called with the full name DefPrinter = FreePDF on FreePDFXP1:. This happens for any printer which is not the default printer. In result CreateDC() fails with ERROR_INVALID_PRINTER_NAME since the full name is not a valid printer name.

See wlx_solidworks.cpp, line 617 for my example.

Could the DefPrinter argument be changed to be either NULL or a valid printer name?
TC plugins: Autodesk 3ds Max / Inventor / Revit Preview, FileInDir, ImageMetaData (JPG Comment/EXIF/IPTC/XMP), MATLAB MAT-file Viewer, Mover, SetFolderDate, Solid Edge Preview, Zip2Zero and more
User avatar
ghisler(Author)
Site Admin
Site Admin
Posts: 50479
Joined: 2003-02-04, 09:46 UTC
Location: Switzerland
Contact:

Post by *ghisler(Author) »

Does this happen only with FreePDF as the printer? Or also with normal printers when you change the default while TC is running?
Author of Total Commander
https://www.ghisler.com
User avatar
tbeu
Power Member
Power Member
Posts: 1354
Joined: 2003-07-04, 07:52 UTC
Location: Germany
Contact:

Post by *tbeu »

It happens with every printer. E.g. DefPrinter = Lexmark T644 (MS) if it is the default printer or DefPrinter = Lexmark T644 (MS) on 198.51.100.42 if it is not set as default. In the first case CreateDC() succeeds in second case it fails.
TC plugins: Autodesk 3ds Max / Inventor / Revit Preview, FileInDir, ImageMetaData (JPG Comment/EXIF/IPTC/XMP), MATLAB MAT-file Viewer, Mover, SetFolderDate, Solid Edge Preview, Zip2Zero and more
User avatar
ghisler(Author)
Site Admin
Site Admin
Posts: 50479
Joined: 2003-02-04, 09:46 UTC
Location: Switzerland
Contact:

Post by *ghisler(Author) »

Interesting, it seems that Delphi is reporting bad printer names to TC in this case. I will check whether I can do anything about it. Does printing in Lister or compare by contents still work?
Author of Total Commander
https://www.ghisler.com
User avatar
tbeu
Power Member
Power Member
Posts: 1354
Joined: 2003-07-04, 07:52 UTC
Location: Germany
Contact:

Post by *tbeu »

ghisler(Author) wrote:Does printing in Lister or compare by contents still work?
Do you mean in TC 8 beta 1?
TC plugins: Autodesk 3ds Max / Inventor / Revit Preview, FileInDir, ImageMetaData (JPG Comment/EXIF/IPTC/XMP), MATLAB MAT-file Viewer, Mover, SetFolderDate, Solid Edge Preview, Zip2Zero and more
User avatar
ghisler(Author)
Site Admin
Site Admin
Posts: 50479
Joined: 2003-02-04, 09:46 UTC
Location: Switzerland
Contact:

Post by *ghisler(Author) »

I mean in the version for which you report this problem. I wonder that when the plugin gets the wrong printer, does that printer still work in Lister, or does it fail too...
Author of Total Commander
https://www.ghisler.com
User avatar
tbeu
Power Member
Power Member
Posts: 1354
Joined: 2003-07-04, 07:52 UTC
Location: Germany
Contact:

Post by *tbeu »

Lister (without plugin) works since it displays the default printer dialog where printer name can be changed again. The active printer name is the one set by the Print setup dialog (as expected).

Lister Print dialog: Image: http://tbeu.de/forum/Print.png
Lister Print Setup dialog:Image: http://tbeu.de/forum/PrintSetup.png
TC plugins: Autodesk 3ds Max / Inventor / Revit Preview, FileInDir, ImageMetaData (JPG Comment/EXIF/IPTC/XMP), MATLAB MAT-file Viewer, Mover, SetFolderDate, Solid Edge Preview, Zip2Zero and more
User avatar
ghisler(Author)
Site Admin
Site Admin
Posts: 50479
Joined: 2003-02-04, 09:46 UTC
Location: Switzerland
Contact:

Post by *ghisler(Author) »

Unfortunately I cannot reproduce it - I checked it in the debugger both with the 32-bit and the 64-bit version.

What I noticed is that TC checked the default printer only when you started it. So when you had printer1 as the default when starting TC, and then changed it to printer2, TC was still sending printer1 to the plugin. Also after changing from printer1 to printer2 and back, TC still sends printer1 here.

I'm on Windows 7 x64, what Windows version do you use?
Author of Total Commander
https://www.ghisler.com
User avatar
tbeu
Power Member
Power Member
Posts: 1354
Joined: 2003-07-04, 07:52 UTC
Location: Germany
Contact:

Post by *tbeu »

ghisler(Author) wrote:and then changed it to printer2
Where did you change the printer? In the Control Panel | Printers configuration or in Lister | Menu Print setup? I guess you checked first case whereas I checked second one.
ghisler(Author) wrote:I'm on Windows 7 x64, what Windows version do you use?
Same OS for me.
TC plugins: Autodesk 3ds Max / Inventor / Revit Preview, FileInDir, ImageMetaData (JPG Comment/EXIF/IPTC/XMP), MATLAB MAT-file Viewer, Mover, SetFolderDate, Solid Edge Preview, Zip2Zero and more
User avatar
ghisler(Author)
Site Admin
Site Admin
Posts: 50479
Joined: 2003-02-04, 09:46 UTC
Location: Switzerland
Contact:

Post by *ghisler(Author) »

Yes, I changed the default printer in Control Panel | Printers. You can't change the default printer in Lister | Menu Print setup, this only changes the printer within Total Commander.

I will check what happens when I change it in Lister | Menu Print setup. Unfortunately it's too late for beta 2 now, but I will try to fix it in a later beta if I can reproduce it.
Author of Total Commander
https://www.ghisler.com
User avatar
tbeu
Power Member
Power Member
Posts: 1354
Joined: 2003-07-04, 07:52 UTC
Location: Germany
Contact:

Post by *tbeu »

ghisler(Author) wrote:I will try to fix it in a later beta if I can reproduce it.
Could you reproduce? I checked with TC8PB5 and got same behaviour as mentioned above.
TC plugins: Autodesk 3ds Max / Inventor / Revit Preview, FileInDir, ImageMetaData (JPG Comment/EXIF/IPTC/XMP), MATLAB MAT-file Viewer, Mover, SetFolderDate, Solid Edge Preview, Zip2Zero and more
User avatar
ghisler(Author)
Site Admin
Site Admin
Posts: 50479
Joined: 2003-02-04, 09:46 UTC
Location: Switzerland
Contact:

Post by *ghisler(Author) »

Unfortunately I could not reproduce it. The name is correct after changing the printer within Total Commander. Tested on Windows 7 with 32-bit and 64-bit version.
Author of Total Commander
https://www.ghisler.com
User avatar
tbeu
Power Member
Power Member
Posts: 1354
Joined: 2003-07-04, 07:52 UTC
Location: Germany
Contact:

Post by *tbeu »

Can anyone please reproduce and confirm? Image: http://tbeu.de/forum/DefPrinter.png
TC plugins: Autodesk 3ds Max / Inventor / Revit Preview, FileInDir, ImageMetaData (JPG Comment/EXIF/IPTC/XMP), MATLAB MAT-file Viewer, Mover, SetFolderDate, Solid Edge Preview, Zip2Zero and more
User avatar
fenix_productions
Power Member
Power Member
Posts: 1979
Joined: 2005-08-07, 13:23 UTC
Location: Poland
Contact:

Post by *fenix_productions »

2tbeu
I did not check the code but I can see changed printers names:
http://fenixproductions.pl/files/tc/printer.png
"When we created the poke, we thought it would be cool to have a feature without any specific purpose." Facebook...

#128099
damjang
Senior Member
Senior Member
Posts: 215
Joined: 2003-10-09, 15:58 UTC
Contact:

Post by *damjang »

I also can see the printer name change, but printer work in every case. This happen only in TC 7.56a. In TC 8.0b1x64 & b5x64 the name don't change (only name of printer without "on USB001" etc.). Win7 x64 here...
Post Reply