1. Tor-Egil Nygaard
  2. PowerBuilder
  3. Friday, 12 October 2018 13:58 PM UTC

Workaround for bug 1732 created by Eric Cole.
To get around the problem related to wrong default printer when connected to Windows Server 2016, or Windows 10, through either RDP or Citrix, you can try this.
It is based on windows api function GetDefaultPrinter and it can be placed in application open event.

Private Function Long GetDefaultPrinterW ( Ref String pszPrinter, Ref Ulong size ) library "winspool.drv" Alias for "GetDefaultPrinterW"

String ls_printer
ULong ul_prnbuf

SetNull ( ls_printer )
GetDefaultPrinterW ( ls_printer, ul_prnbuf ) //Returns nbr. of characters needed to hold the printername.
If ul_prnbuf > 0 Then
ls_printer = Space ( ul_prnbuf )
  GetDefaultPrinterW ( ls_printer, ul_prnbuf )
End If
//If ls_printer holds a value then use PB PrintSetPrinter to set default application printer
If ls_printer <> "" Then
  PrintSetPrinter ( ls_printer )
End If

/*
Before Windows 10/Win. Server 2016 you would find the default printer in reg. key :
  HKEY_CURRENT_USER\Software\Microsoft\Windows NT\CurrentVersion\Windows:Device
It did not matter if you were logged in through RDP/Citrix or directly on the machine.
Now, if you are connected through RDP/Citrix the default printer is stored in this reg. key :
  HKCU\Software\Microsoft\Windows NT\CurrentVersion\Windows\SessionDefaultDevices\PART_OF_SID\Device
*/

TEN

Chris Pollach @Appeon Accepted Answer Pending Moderation
  1. Friday, 12 October 2018 14:07 PM UTC
  2. PowerBuilder
  3. # 1

Hi TEN;

  FYI: This issue was fixed in the PB2017R3 release that came out at the end of July, 2018.

PS: Also relates to Ticket # 1064 as well.

Regards ... Chris

Comment
  1. Tor-Egil Nygaard
  2. Friday, 12 October 2018 14:23 PM UTC
I am sorry to say that this is still a problem.

Running PB 2017 R3 build 1858 on Windows 10 build 1803 connecting to a Windows Server 2016/Windows 10 through RDP/Citrix and running PrintSetup() will return the (latest) local default printer on the server as the selected entry in the list. Not the local default printer on my machine.

It is quite easy to test if you have a locale printer which does not exist on then server.



Regards

TEN
  1. Helpful
  1. Chris Pollach @Appeon
  2. Friday, 12 October 2018 15:36 PM UTC
Hi TEN;

Thanks for the feedback and our sincere apologies for this fix not working 100%!

I will notify our Appeon Support team on this.

Regards .. .Chris

  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.