Skip to main content

Is there a way to dynamically set WINPRINT-PORT, or is that limited to WINPRINT-CURR- values?



------------------------------
Ken Schwartz
Senior Engineer, Development
Southware Innovations, Inc
Opelika US
------------------------------

Is there a way to dynamically set WINPRINT-PORT, or is that limited to WINPRINT-CURR- values?



------------------------------
Ken Schwartz
Senior Engineer, Development
Southware Innovations, Inc
Opelika US
------------------------------

Looking through the source code for WIN$PRINTER, it is possible to set WINPRINT-PORT using WINPRINTER-SET-SETTINGS. Whether the underlying Windows API actually uses that information is beyond our control.



------------------------------
Randy Zack
Principal Software Engineer
Rocket Forum Shared Account
------------------------------

Looking through the source code for WIN$PRINTER, it is possible to set WINPRINT-PORT using WINPRINTER-SET-SETTINGS. Whether the underlying Windows API actually uses that information is beyond our control.



------------------------------
Randy Zack
Principal Software Engineer
Rocket Forum Shared Account
------------------------------

Hi Ken,

I haven't tried this, and it may not work, in which case it is not possible to set the PORT value dynamically. But again, reading through the source, it appears that the BUFFER passed to WINPRINTER-GET-SETTINGS and WINPRINTER-SET-SETTINGS is the WINPRINT-SELECTION  data item defined in winprint.def.

Note that even if this works on your system, there is no guarantee that it will work on the system of one of your users. I believe the best you can do is to try it out on your system, and if it works to try it on other computers, and make a note somewhere saying that this is not something guaranteed to work.



------------------------------
Randy Zack
Principal Software Engineer
Rocket Forum Shared Account
------------------------------

Hi Ken,

I haven't tried this, and it may not work, in which case it is not possible to set the PORT value dynamically. But again, reading through the source, it appears that the BUFFER passed to WINPRINTER-GET-SETTINGS and WINPRINTER-SET-SETTINGS is the WINPRINT-SELECTION  data item defined in winprint.def.

Note that even if this works on your system, there is no guarantee that it will work on the system of one of your users. I believe the best you can do is to try it out on your system, and if it works to try it on other computers, and make a note somewhere saying that this is not something guaranteed to work.



------------------------------
Randy Zack
Principal Software Engineer
Rocket Forum Shared Account
------------------------------

Randy, I verified that if I

  1. Set the printer (WINPRINT-SET-PRINTER-EX)
  2. Get printer settings (WINPRINT-GET-SETTINGS) using the resulting WINPRINT-SELECTION in BUFFER,

BUFFER is returned with a bunch of binary data relating to the printer.  However, if I set WINPRINT-PORT using WINPRINT-SET-SETTINGS, there is no evidence that the port has changed.

In any case, it does not seem that this is a viable production solution, since it would need to work for all of our clients.

  1. creates a bunch of binary data related to the printer in BUFFER when I use 


------------------------------
Ken Schwartz
Senior Engineer, Development
Southware Innovations, Inc
Opelika USSenior Engineer, Development
------------------------------