1. Tracy Lamb
  2. PowerBuilder
  3. Friday, 31 January 2020 21:19 PM UTC

I have a default printer in Windows. In my application, when the print dialog box displays I select a different printer but the datawindow still prints to the Windows default printer.  I have to close my application, change the Windows default printer, then re-open my application.

I've seen some suggestions on writing my own dialog windows and use a combination of PrintGetPrinter, PrintSetPrinter, GetDefaultPrinter, etc. This gets pretty complicated, and doesn't it defeat the purpose of the print dialog box?

Can someone share a script/method/window with me that will popup the print dialog box and then print to the selected printer?

Thank you,

Tracy

Who is viewing this page
Olan Knight Accepted Answer Pending Moderation
  1. Friday, 28 August 2020 00:07 AM UTC
  2. PowerBuilder
  3. # 1

// Get a list of printers
ls_printer_list_array = PrintGetPrinters()

// Get the current printer
ls_printer = PrintGetPrinter()


// To set the default printer for the Windows platform
// Get the selected printer
ls_new = dw_1.GetitemString (ll_new, "printername")
        
// Reset the default printer
ll_result = RegistrySet("HKEY_CURRENT_USER\Software\Microsoft\Windows NT\CurrentVersion\Windows",   &
                              "Device", RegString!, ls_new)
                                        
IF (ll_result = 1) THEN
                
      // Set the printer for the next PRINT job
      ll_result = PrintSetPrinter (ls_new)

ELSE
   // Error processing
END IF


Later -

Olan

Comment
There are no comments made yet.
Govinda Lopez @Appeon Accepted Answer Pending Moderation
  1. Tuesday, 25 August 2020 15:11 PM UTC
  2. PowerBuilder
  3. # 2

Hi Tracy,

 

This is a common issue when using RDS or Terminal Services. It is not exclusive to PB apps but it is actually a known issue for quite a while now and it affects many different types of apps.

 

On the following Knowledgebase Article you may find 2 workarounds you can implement for PB apps. You may ignore any reference to the RTE control and only use anything related to the Remote Default Printer described on the KBA that might be of help. 

 

I also suggest you to check with the system admins if they can make sure that the "Use the client default printing device" option be set properly over your environment. This could help avoid a lot of headaches.

 

I hope this is helpful.

 

 

Regards,

Comment
There are no comments made yet.
Yeshwanth Krishna Prasad Accepted Answer Pending Moderation
  1. Tuesday, 25 August 2020 12:46 PM UTC
  2. PowerBuilder
  3. # 3

I have been using PB19 with RDS and having issues with default printer. The default printer will not be the one selected when logged on. Is this a bug within the PB19? is there a fix for this?

Comment
  1. Armeen Mazda @Appeon
  2. Tuesday, 25 August 2020 15:35 PM UTC
Please see Govinda’s reply for the solution.
  1. Helpful
There are no comments made yet.
Georg Brodbeck Accepted Answer Pending Moderation
  1. Monday, 3 February 2020 09:53 AM UTC
  2. PowerBuilder
  3. # 4

Have you tried the printsetup() function yet? We use that with PB11.5 as well as 2017 R3 both on  Windows 10 without problems.

Comment
  1. Tracy Lamb
  2. Monday, 3 February 2020 16:05 PM UTC
Thanks... will try that today.
  1. Helpful
There are no comments made yet.
Tracy Lamb Accepted Answer Pending Moderation
  1. Saturday, 1 February 2020 17:27 PM UTC
  2. PowerBuilder
  3. # 5

No!  It seems to be a new behavior with the combination of Windows 10 and PB12 applications.  My applications are all native Win-32 apps.  It does this in both my development environment as well as my compiled applications.  My development environment is Appean PB2017 R2.  Deployed applications are Sybase PB12.

Comment
There are no comments made yet.
Tracy Lamb Accepted Answer Pending Moderation
  1. Friday, 31 January 2020 21:35 PM UTC
  2. PowerBuilder
  3. # 6

No!  It seems to be a new behavior with the combination of Windows 10 and PB12 applications.  My applications are all native Win-32 apps.  It does this in both my development environment as well as my compiled applications.

Comment
  1. Chris Pollach @Appeon
  2. Friday, 31 January 2020 22:13 PM UTC
FWIW: If you are on a PB v12.x release ( from Sybase), these releases were not W10 certified. So that could be where this improper behaviour is coming from.
  1. Helpful
There are no comments made yet.
Chris Pollach @Appeon Accepted Answer Pending Moderation
  1. Friday, 31 January 2020 21:28 PM UTC
  2. PowerBuilder
  3. # 7

Hi Tracy;

   This has been an issue when using RDT or Citrix to run your PB App(s) vs native MS-Windows.

Is this the scenario in your case?

Regards ... Chris

Comment
  1. Tracy Lamb
  2. Saturday, 1 February 2020 19:57 PM UTC
No! It seems to be a new behavior with the combination of Windows 10 and PB12 applications. My applications are all native Win-32 apps. It does this in both my development environment as well as my compiled applications. My development environment is Appean PB2017 R2. Deployed applications are Sybase PB12.
  1. Helpful
  1. Yeshwanth Krishna Prasad
  2. Tuesday, 25 August 2020 12:47 PM UTC
I have been using PB19 with RDS and having issues with default printer. The default printer will not be the one selected when logged on. Is this a bug within the PB19? is there a fix for this?
  1. Helpful
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.