Home

Communication Horizons
established 1986

Home
Contact

 

Knowledgebase Index
About Us
Contact
Legacy Products


Communication Horizons
65 High Ridge Rd. #428
Stamford CT 06905

support

800-480-1604
203-321-1278
fax  286-1056

       

Knowledgebase


>>ITEM : N00126   
>>DATE: 10/22/96    
>>TYPE: Information

>>TITLE: How to capture to a file on NetWare

>>PRODUCT(S):
NetLib 6.5x for Clipper
NetLib 2.0 or later for FoxPro DOS
NetLib 2.0 or later for FoxPro Windows

>>PLATFORMS(S):
NetWare (all versions)

>>SUMMARY:
This article illustrates how to capture to a file instead 
of a 
print queue.

>>MORE INFORMATION:
It is sometimes useful to capture to a file that will be 
printed at a later time, rather than printing directly to 
a print queue.

The N_CAPSET function does not permit capturing to 
a file.  However, this can easily be accomplished with 
the use of "Customizeable APIs" as illustrated in the 
example below.

Use N_QFILE to place the file on a print queue when 
desired.

>>RESOLUTION/FIX:


>>EXAMPLE(S):
The following example, FILECAP.PRG was written 
for Clipper 87.It can be used unchanged with Clipper 
5.x or easily modified for use with FoxPro.

* FILECAP.PRG
N_READY()
* Must be a full network path in an existing directory
* E.g., SYS:TEMP\FILECAP.OUT
ACCEPT "Capture to file: " TO cTo
nError = StartFileCap(cTo)
IF nError == 0
    SET CONSOLE OFF
    TYPE FILECAP.PRG TO PRINT
    SET CONSOLE ON
    EndFileCap()
    ? "Success"
    ** optionally place on queue
    ACCEPT "Queue: " TO cQue
    IF !EMPTY(cQue)
        nJob = N_QFILE(cQue,cTo)
        ? "Job Number: ", nJob
        IF nJob != 0
            nError = N_ERROR()
            ? "Error code:", nError
        ENDIF
    ENDIF
ELSE
    ? "Error code:", nError
ENDIF
RETURN

FUNCTION StartFileCap
* parameters:
* cFile = File to capture to. 
*  Must be on a network drive.
* nDev = Device number 
* 0=LPT1, 1=LPT2, etc.  Default is 0.
* There does not need to be an actual physical device
PARAMETER cFile, nDev
PRIVATE Q,P, CY
IF PCOUNT() == 1
    nDev = 0
ENDIF
A_ZAPREGS()    && clear registers
A_AX("DF00")   && set up API registers
A_DH(nDev)
A_DL(5)
A_EXECINT()    && end any capture that is active
Q = A_ALLOC(LEN(cFile)+5) 
* allocate buffers for API
P = A_ALLOC(2)
A_ZAPREGS()
A_WORD(Q,LEN(cFile)+3)  && set up buffers
A_BYTE(Q+2,9)
A_BYTE(Q+4,LEN(cFile))
A_STRING(Q+5,cFile)
A_AX("E000")
A_DS_SI(Q)
A_ES_DI(P)
CY = A_EXECINT()    && specify capture file
A_FREE(Q)              && free buffers
A_FREE(P)
IF CY
    RETURN A_AL()    && Carry Flag means error
ENDIF
A_ZAPREGS()
A_AX("DF00")
A_DH(nDev)
A_DL(4)
CY = A_EXECINT()     && begin capture
IF CY
    RETURN A_AL()     && Carry Flag means error
ENDIF
RETURN 0

FUNCTION EndFileCap
* parameters:
* nDev = Device number
* 0=LPT1, 1=LPT2, etc.  Default is 0.
* Should be same device as used to start capture
PARAMETER nDev
IF PCOUNT() == 0
    nDev = 0
ENDIF
A_ZAPREGS()
A_AX("DF00")
A_DH(nDev)
A_DL(5)
A_EXECINT()            && end capture
RETURN A_AL()
* end FILECAP.PRG

>>SEE ALSO:


>>COPYRIGHT 1997 Communication Horizons
All rights reserved worldwide.
No distribution without specific consent of publisher.




Home Top

 

© Copyright 2001 Communication Horizons LLC.
“NetLib” and “Encryptionizer” are Registered Trademarks of Communication Horizons.
US and international patents pending.
Updated 29 Dec 2001