Talk About Network

Google


Register and Login
Nick
Password
Register create new account Sign up is FREE and you can post replies, new topics, bookmark posts and more!
Recover lost password


Programming > Clipper > Re: SET PRINTER...
Latest [ Topics | Posts ] Archive Post A New Topic Post a Reply
<< Topic < Post Post 2 of 3 Topic 3822 of 3959
Post > Topic >>

Re: SET PRINTER TO and SET DEFAULT

by sebas22 <nospam@[EMAIL PROTECTED] > Jan 15, 2008 at 02:21 PM

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
 




 3 Posts in Topic:
SET PRINTER TO and SET DEFAULT
cherszage@[EMAIL PROTECTE  2008-01-15 05:33:16 
Re: SET PRINTER TO and SET DEFAULT
sebas22 <nospam@[EMAIL  2008-01-15 14:21:01 
Re: SET PRINTER TO and SET DEFAULT
cherszage@[EMAIL PROTECTE  2008-01-15 07:41:24 

Post A Reply:
  Go here to Signup

AddThis Feed Button


About - Advertising - Contact - Frequently Asked Questions - Privacy Policy - Terms of Use - Signup

Contact
tan12V112 Sat Jul 26 3:21:44 CDT 2008.