On Tue, 15 Jan 2008 05:33:16 -0800 (PST), cherszage@[EMAIL PROTECTED]
wrote:
>Hi
>I recently discovered that if I issue a SET PRINTER TO LPTx after a
>SET DEFAULT TO a different folder, clipper tries to create a file
>named LPTx.PRN in the default directory and of course generates a
>CREATE ERROR.
>Without th SET DEFATLT TO command it does work as it should.
>This happens in W2K/XP machines, doesn't in W98.
My solution is a custom function SetPrinterTo().
You can #translate your SET PRINTER TO to call it :
/* SetPrinterTo(), to nullify _SET_DEFAULT before a set printer to.
* SET PRINTER TO cFile => SetPrinterTo( cFile )
* SET PRINTER TO cFile ADDITIVE => SetPrinterTo( cFile, .T. )
* SET PRINTER TO => SetPrinterTo( "" )
* Remarque : SetPrinterTo() gives the current setting without
changing anythg
*/
#include "hcommon.ch" // for isnil()
function SetPrinterTo( cPrintFile, lAdd )
local cOldDefault
local cOldPrintFile := set(_SET_PRINTFILE)
if ! isnil(cPrintFile)
cOldDefault := set(_SET_DEFAULT, "" )
set(_SET_PRINTFILE, cPrintFile, lAdd)
set(_SET_DEFAULT, cOldDefault)
endif
return cOldPrintFile
--
Ciao,
Sebas


|