1. Subbiya Vasumoorthy
  2. PowerBuilder
  3. Thursday, 26 September 2024 18:38 PM UTC

Hi Appeon Team,
Good Morning!

We are on PowerBuilder 2022 R3 Build 3356. I am using powerwhizz user object to modify the default system printer settings. I was able to get the information about the system printer settings but when I try to modify the printer settings, it calls the SetPrinter API and in this place I'm getting the below error and the code calls that API are attached below. Can you please help me out to resolve the issue.



 

 







Who is viewing this page
John Fauss Accepted Answer Pending Moderation
  1. Thursday, 26 September 2024 19:50 PM UTC
  2. PowerBuilder
  3. # 1

Hi, Subbiya -

Are you running this app in 32-bit or 64-bit? If you are using 64-bit, can you test in 32-bit to see if it works?

The error appears to occur when the SetPrinter Windows API function is called. If I were to guess, I'd say the issue may be related to the structure that is passed by reference to this API. The value 2 that is passed as the second argument to this API function indicates that a PRINTER_INFO_2 structure is to be passed, which you did not provide in your post.

This object/code is pretty old (roughly 25 years) and passes character and string information in ANSI instead of Unicode, but someone has made changes to switch the datatype of Windows handles to Longptr.

Are you able to zip the exported source for the n_powerwhizz object and a small test app that exhibits the problem issue? If so, I can take a look and try to find the problem in my spare time.

Best regards, John

Comment
There are no comments made yet.
Chris Pollach @Appeon Accepted Answer Pending Moderation
  1. Thursday, 26 September 2024 19:42 PM UTC
  2. PowerBuilder
  3. # 2

Hi Subbiya;

  Unfortunately, the PowerWiz product is long time outdated / deprecated and is using very old ANSI external API's conventions (OK for old MS-Windows versions). As PB is now Unicode (as of PB version 10.x) and so are today's MS-Window versions (W10 & higher, W2016 & higher), these old API calls should be refactored to use Unicode conventions. However, these external APIs might not exist of have been refactored by Microsoft - so they may not even be supported any longer my recent MS-Window releases. Added to that, Appeon PB is now build and runs on VC++ 2022 which is a much newer "C" compiler from Microsoft - adding to the requirement to only us Unicode practices.

  The good news though is that Appeon PB has native printer commends to now allow PB Apps to control printers. Have a look at the new PrintGetPrinter, PrintGetPrinters, PrintSetPrinter and PrintSetupPrinter built-in native commands.  HTH

Regards .. Chris

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.