1. Joseph Neville
  2. PowerBuilder
  3. Monday, 22 January 2024 23:16 PM UTC

I'm working on migrating our application to PB2022 from PB2017 R3 and found that our print settings dialog no longer sets the printer for our application. I double checked the registry location we are using for it (HKEY_CURRENT_USER\SOFTWARE\Microsoft\Windows NT\CurrentVersion\Windows\Device) and that is properly being changed, but when we print, it uses the system default printer instead of what the user configured.

 

Has PB2022 changed the registry location it gets the selected printer from when the datawindow Print() function is called? If so, where is it so I can change the location it looks?

John Fauss Accepted Answer Pending Moderation
  1. Tuesday, 23 January 2024 02:49 AM UTC
  2. PowerBuilder
  3. # 1

Hi, Joseph -

If I had to guess, PB probably uses the GetDefaultPrinter Windows API function to obtain the name of the user's default printer, and the EnumPrinters Windows API function to obtain a list of all of the defined printers available to the user.

Unless directed otherwise via the PrintSetPrinter PowerScript function, a PB app will use the Windows printer that is marked as the default printer, which I believe is the behavior you are seeing. This is mentioned in the PB Help section for the PrintGetPrinter PowerScript function. While this may not be the behavior you are accustomed to, this is how PB behaves now.

It is possible to alter this default behavior by using the PrintGetPrinters PowerScript function to obtain a string that contains a list of all available printers and the PrintSetPrinter PowerScript function to change the printer that the PB app uses. Using PrintSetPrinter does not change the Windows default printer.

You may wish to enhance your app to give the user a means of identifying their preferred printer, saving this selection for subsequent use, then check the PB default printer on app startup and change it to the user's preferred printer if needed.

Best regards, John

Comment
There are no comments made yet.
Chris Pollach @Appeon Accepted Answer Pending Moderation
  1. Monday, 22 January 2024 23:50 PM UTC
  2. PowerBuilder
  3. # 2

Hi Joseph;

  Are you using the current (and Long Term Support) PB 2202 R3 revision?

Regards... Ch

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.
We use cookies which are necessary for the proper functioning of our websites. We also use cookies to analyze our traffic, improve your experience and provide social media features. If you continue to use this site, you consent to our use of cookies.