printing on shared receipt printer in Win7 environment doesn

Posted by ruan007 on 01-Jun-2010 21:50

Hello Guys,

I have encountered a problem with printing on windows 7 from 4gl code. we have two computers(till_01 and till_02) just upgraded to Win7, and a receipt printer is installed and shared in till_01, When we tried to print a cash receipt from till_02 using the following code, we received Error "**Unable to open file: \\till_01\receipt. Errno=2.(98)"

DEF VAR spoolFile AS CHAR NO-UNDO.
DEF VAR cprinter   AS CHAR         NO-UNDO.
DEF VAR memoryFile  AS MEMPTR       NO-UNDO.

assign
    spoolFile = "c:\temp\receipt.txt"
    cprinter  = "\\till_01\receipt".

FILE-INFO:FILE-NAME = spoolFile.
SET-SIZE(memoryFile) = FILE-INFO:FILE-SIZE.

INPUT FROM VALUE(spoolFile) BINARY NO-CONVERT.
IMPORT memoryFile.
INPUT CLOSE.

OUTPUT TO VALUE(cprinter) BINARY NO-CONVERT.
EXPORT memoryFile.
OUTPUT CLOSE.

SET-SIZE(memoryFile) = 0.

This problem only seem to occur in a win7 to win7 environment, the printing works when one of the till is not win7. such as winXP/win7, Win2000/Win7, XP/XP. I am not sure if it is a security issue, Can anybody shed some lights please?

Thanks in advance.

All Replies

Posted by Admin on 07-Jun-2010 02:31

Hello,

We have the same problem in our application which contains some direct-printing documents like your example

If anyone has a clue ...

Thanks

Posted by Admin on 10-Jun-2010 07:49

We  found it !

Before, we used to print with this :

      OUTPUT TO  "\\CBERTHOLIN\epsoncb" PAGED.

     PUT UNFORMATTED "Essai d'impression directe"  SKIP.

     OUTPUT  CLOSE.

And, now, it's works with  this :   

     SESSION:PRINTER-NAME =  "\\CBERTHOLIN\epsoncb".

     OUTPUT TO PRINTER PAGED.

     PUT UNFORMATTED "Essai d'impression directe"  SKIP.

     OUTPUT  CLOSE.

Does it works for you ??

Posted by DimitriG4 on 10-Jun-2010 14:55

Vista has the same problem. (running 9.1E )

Here is my before and after:

BEFORE Vista:

OUTPUT TO value(v-labelfile).

     PUT UNFORMATTED .......

OUTPUT CLOSE.

AFTER Vista

OUTPUT TO VALUE(v-outputfile)

    PUT UNFORMATTED .......

OUTPUT CLOSE.


OS-COPY value(v-labelfile) VALUE(v-printername).
OS-DELETE VALUE(v-labelfile).

So far it works great

Posted by ruan007 on 11-Jun-2010 02:22

Thank you guys,

I really appreaciate your help. I will give it a shot next week.

Cheers

This thread is closed