1. Stacey Price
  2. PowerBuilder
  3. Tuesday, 13 December 2022 19:32 PM UTC

I want to be able to change the default windows printer after I open the pb application and have the pb application pick up that new windows default printer without me having to restart my pb application.  Today, once the pb app has the default printer, even if i use PrintGetPrinter, it does not get the updated default printer.  I have to shut down and reopen the pb app.  

This used to work in previous version. 

Does anyone else have this problem?  The chatter around this seems to suggest that this a pb bug.  

Thanks!

Roland Smith Accepted Answer Pending Moderation
  1. Wednesday, 14 December 2022 14:58 PM UTC
  2. PowerBuilder
  3. # 1

There is a PrintGetPrinters function that will return a list of printers. Check the help topic for details.

 
Comment
  1. Chris Pollach @Appeon
  2. Thursday, 15 December 2022 18:47 PM UTC
Hi Stacey;

I believe that PB was updated from that old default print behaviour because many customers did not want that. They wanted the PB App to always automatically print to the "Currently set" default printer.

Regards ... Chris
  1. Helpful
  1. Stacey Price
  2. Thursday, 29 December 2022 19:05 PM UTC
That is not what is happening for us. It doesn't print to the "currently set" default printer. It prints to the default printer that was set prior to starting the pb application. If we want to change where we are automatically printing to, we have to change the windows default printer and then also close and restart our pb app for it to recognize the new default printer. Is that the expected behavior? thanks!
  1. Helpful
  1. Chris Pollach @Appeon
  2. Thursday, 29 December 2022 19:26 PM UTC
Hi Stacey;

Just change the command to ...

DC.Print (TRUE, TRUE)

and let the App user control the printer they want to use.

Food for thought.

Regards.... Chris
  1. Helpful
There are no comments made yet.
Mark Goldsmith Accepted Answer Pending Moderation
  1. Wednesday, 14 December 2022 13:45 PM UTC
  2. PowerBuilder
  3. # 2

Hi Stacey...on the OS I'm using at the moment (Windows 10 Pro Version 21H2 Build 19044.2251), the registry key locations are as follows:

1) Available Printers: HKEY_CURRENT_USER\SOFTWARE\Microsoft\Windows NT\CurrentVersion\Devices

2) Default Printer: HKEY_CURRENT_USER\SOFTWARE\Microsoft\Windows NT\CurrentVersion\Window

HTH...regards,

Mark

Comment
There are no comments made yet.
Benjamin Gaesslein Accepted Answer Pending Moderation
  1. Wednesday, 14 December 2022 08:28 AM UTC
  2. PowerBuilder
  3. # 3

The PB help file for PrintGetPrinter() states:

The current printer is the default printer unless you change it with the PrintSetPrinter method. A PowerBuilder application calling the PrintGetPrinter method does not get an externally reset default after the application initializes.

So I guess reading it from the registry is the only way.

Comment
There are no comments made yet.
Olan Knight Accepted Answer Pending Moderation
  1. Tuesday, 13 December 2022 21:09 PM UTC
  2. PowerBuilder
  3. # 4

The list of printers available to you are located in the Windows Registry:
           HKEY_LOCAL_MACHINE\SYSTEM\CurrentControlSet\Control\Print\Printers\
           - Each subkey is a different printer

<Updated on 14-DEC-2022>
The default printer is per user, so:
          "HKEY_CURRENT_USER\Software\Microsoft\Windows NT\CurrentVersion\Windows"
          "Device"

Changing the Default Printer in the Registry makes the change immediate, and the next call to PrintGetPrinter() should return the changed value.

 

 

 

 

Comment
There are no comments made yet.
  • Page :
  • 1


There are no replies made for this question yet.
However, you are not allowed to reply to this question.