Plateforme Level Extreme
Abonnement
Profil corporatif
Produits & Services
Support
Légal
English
Printing to Serial Port in TS
Message
De
12/09/2005 09:44:31
 
 
À
12/09/2005 00:37:32
Information générale
Forum:
Visual FoxPro
Catégorie:
Codage, syntaxe et commandes
Versions des environnements
Visual FoxPro:
VFP 9
OS:
Windows XP SP2
Network:
Windows 2003 Server
Database:
Visual FoxPro
Divers
Thread ID:
01048232
Message ID:
01048748
Vues:
18
This message has been marked as the solution to the initial question of the thread.
>> I have figured out that the MS Comm object won't work over TS, as it returns an error.
>
>Could you post the error returned, some repro code and settings you used on the MSCOmm object and what event caused the error?
>
>Was it "PortOpen" or was it something else?
>
>Bernard

The error occurred in the MSComm object initialization. Said the port was being used by another application and to quit both applications and restart. No other application was open. The same application returns no errors when run from a PC.

I did find a workaround for this:

First we made sure the port was mapped in RDC settings. We also made sure that serial ports were allowed to be mapped on the TS. Once we logged in to TS, we ran the CHANGE PORTS command to display which ports were available and how they were mapped.

In the application, I disabled the initialization of the MSComm object. I then used code I found on UT to make a file with STRTOFILE() and then used a shell command to RUN PRINT /D:COM:1 test.txt

Here is a code snippet:
#DEFINE SOH CHR(1)
#DEFINE STX CHR(2)
#DEFINE ETX CHR(3)
#DEFINE EOT CHR(4)

lcFR = '11999'                      && Part number
lcStr = STX + '?:' + lcFR + ETX     && Build the configuration string to send to the marker
STRTOFILE(lcStr, "test.txt")        && Create file from string
       
lcStr = STX + ;
    ALLTRIM(Block.Serial_Number) + ;
    SOH                             && Get the serial Number
STRTOFILE(lcStr, "test.txt", 1)     && Add Serial Number format to text file
STRTOFILE(EOT,"test.txt",1)         && Add end of transmission
run print /D:com1 test.txt          && Shell out to command window and Print
ERASE test.txt                      && Delete the file
If anyone has a cleaner way of running this, I'm open to it. Hope this can help someone else who may be trying to print out to a serial port on Terminal Server.
Duty is ours, the results are God's - John Quincy Adams
Précédent
Répondre
Fil
Voir

Click here to load this message in the networking platform