printer redirected from the client machine is used when running in an RDP environment
Posted: Thu Aug 11, 2022 1:28 am
Dear Roger,
https://ilx.alaska-software.com/index.p ... a.9/page-2
has the following solution:
Ensure the printer redirected from the client machine is used when running in an RDP environment
Thread starter Pat France Start dateOct 6, 2021
Creating a printer object with the following code
Xbase++:
oPrinter := XbpPrinter():new():create()
returns a printer object for the system's default printer. Normally, this is the default printer configured in the system settings. When connecting to a machine via RDP, however, clients can optionally redirect the default printer to the one configured for the client machine. In this case, applications running within the RDP session are expected to print to the redirected printer instead.
However, on certain operating systems (Windows Server 2016/Windows 10 and newer) the redirected printer is not reported correctly to the Xbase++ runtime. This causes the default printer configured for the RDP server to be used instead. This issue is described in the following PDR: http://www.alaska-software.com/scri...K ... PDRID=7101.
As a work-around, a Win32 API function can be used for determining the name of the (possibly redirected) default printer, which is outlined in the following code:
Xbase++:
#include "dll.ch"
#include "set.ch"
#include "collat.ch"
EXTERN BOOL Win32GetDefaultPrinter( @pszBuffer AS STRING, @pcchBuffer AS UINTEGER ) IN winspool.drv NAME GetDefaultPrinter
FUNCTION GetDefaultPrinterName()
LOCAL cName := Space( 255 )
IF Win32GetDefaultPrinter(@cName, 255)
cName := RTrim( cName )
IF Set(_SET_CHARSET) == CHARSET_OEM
cName := ConvToOemCp( cName )
ENDIF
RETURN cName
ENDIF
RETURN ""
The above function with the work-around can be used for creating a printer object as follows:
Xbase++:
oPrinter := XbpPrinter():new():create( GetDefaultPrinterName() )
I really need this, but in DCPRINT
How to do this in eXpess++?
I have eXpress++ version 2.0.268
I thank you in advance for a possible answer
https://ilx.alaska-software.com/index.p ... a.9/page-2
has the following solution:
Ensure the printer redirected from the client machine is used when running in an RDP environment
Thread starter Pat France Start dateOct 6, 2021
Creating a printer object with the following code
Xbase++:
oPrinter := XbpPrinter():new():create()
returns a printer object for the system's default printer. Normally, this is the default printer configured in the system settings. When connecting to a machine via RDP, however, clients can optionally redirect the default printer to the one configured for the client machine. In this case, applications running within the RDP session are expected to print to the redirected printer instead.
However, on certain operating systems (Windows Server 2016/Windows 10 and newer) the redirected printer is not reported correctly to the Xbase++ runtime. This causes the default printer configured for the RDP server to be used instead. This issue is described in the following PDR: http://www.alaska-software.com/scri...K ... PDRID=7101.
As a work-around, a Win32 API function can be used for determining the name of the (possibly redirected) default printer, which is outlined in the following code:
Xbase++:
#include "dll.ch"
#include "set.ch"
#include "collat.ch"
EXTERN BOOL Win32GetDefaultPrinter( @pszBuffer AS STRING, @pcchBuffer AS UINTEGER ) IN winspool.drv NAME GetDefaultPrinter
FUNCTION GetDefaultPrinterName()
LOCAL cName := Space( 255 )
IF Win32GetDefaultPrinter(@cName, 255)
cName := RTrim( cName )
IF Set(_SET_CHARSET) == CHARSET_OEM
cName := ConvToOemCp( cName )
ENDIF
RETURN cName
ENDIF
RETURN ""
The above function with the work-around can be used for creating a printer object as follows:
Xbase++:
oPrinter := XbpPrinter():new():create( GetDefaultPrinterName() )
I really need this, but in DCPRINT
How to do this in eXpess++?
I have eXpress++ version 2.0.268
I thank you in advance for a possible answer