Plateforme Level Extreme
Abonnement
Profil corporatif
Produits & Services
Support
Légal
English
Barcoding
Message
De
30/07/1998 17:39:42
 
 
À
28/07/1998 11:37:21
Information générale
Forum:
Visual FoxPro
Catégorie:
Autre
Titre:
Divers
Thread ID:
00121737
Message ID:
00122882
Vues:
20
>Hi William ---
>
>>
>>There is an Application (written in FPW 2.6) that for some reason uses the comm port to download data from a hand held barcoding device (capture the data on the floor plant and the donwload the data to the Application PC.) but that application doesn't work with Win NT because uses an old DOS based program to reach the comm port what could be the best approach to solve this problem?
>
>Solve it in FPW 2.6 or VFP? The best approach, in general, would be to get the handshaking and data transfer specs from the handheld and then write code to call Windows API comm functions.
Help Please!!

Here are the first lines of code that has to converted to make it work with windows, using VFP code, the original code was written in FOX 2.5 for DOS in order to open the comm port....

FPW 2.6 does not has the ability to open the comm port (may be I'm wrong)...

Any suggestion on how to take this approach in convertin this code to VFP in order to open the comm port....
Here is the code:

CLEAR
CLOSE ALL
CLEAR ALL
SET TALK OFF
SET SAFETY OFF
SET EXCLUSIVE OFF
SET DELETED ON
m.gcDataDir="W:\DATA\"
m.StartChar="@" && Start Transmit Protocol Character
m.Reclength=82 && Remember to add 2 bytes for Carriage Ret/Line Feed
* Issue DOS Mode Command
RUN MODE COM1:96,e,7,1 && this command open the port....
*
CLEAR
CLEAR TYPEAHEAD
m.Com=FOPEN('COM1',2) &&...or this comand open the port?
IF m.Com > -1
?"*** Instructions for Transmitting Data from Intermec 9445 Scanner **"
?" V1.1 "
?" 1. Set the Handheld unit on the Transmitting Dock"
?" 2. Turn the Handheld unit on and wait for Ready message"
?" 3. Make sure the Transmitting Dock Ready and Power light is on"
?" 4. Press Ctrl+Enter then B on the unit to get to the MENU"
?" 5. Select option T to Transmit and press Enter"
?" 6. Press Y on the PC to begin transmission or"
?" press any other key to Exit without transmitting"
?" "
m.Key = ""
DO WHILE EMPTY(m.Key)
m.Key = INKEY()
ENDDO
IF UPPER(CHR(m.KEY)) = "Y"
?"Starting to Receive Data"
ELSE
?"Data Transmission Cancelled!"
CLOSE ALL
CLEAR
CANCEL
ENDIF
ELSE
?"-- Error: Unable to open Communication Port --"
WAIT WINDOW "Press Enter to Continue"
CLOSE ALL
CLEAR
CANCEL
ENDIF
* Remember to count carriage return/linfeed
RESTORE FROM Handheld ADDITIVE && Get next file control number
m.ScanFile="SCAN"+STR(m.Scannum,4)+".TXT"
m.Filehndl=FCREATE(m.ScanFile)
IF M.Filehndl < 0
?"-- Error: Unable to Create Data File --"
WAIT WINDOW "Press Enter to Continue"
CLOSE ALL
CLEAR
CANCEL
ENDIF
* Save next file control scan number
m.Scannum=m.Scannum+1
SAVE TO Handheld ALL LIKE Scannum
* Revert to current scan number
m.Scannum=m.Scannum - 1
m.ComSend=FPUTS(m.Com,m.StartChar,LEN(m.StartChar)+2)
m.ComRec=""
i=0
m.Eofflag=.F.
DO WHILE m.Eofflag = .F.
i=i+1
m.ComRec=FGETS(m.Com,m.Reclength)
m.Eofflag = "1EOF" $ m.ComRec
IF m.Eofflag =.F.
IF i=1
m.ComRec=STRTRAN(m.ComRec,CHR(0),'') && Remove Gargage
ENDIF
m.ComRec=STRTRAN(m.ComRec,CHR(16),'') && Remove Garbage
m.FileRec=FPUTS(M.Filehndl,m.ComRec,m.RecLength-2)
?"Received Rec# "+STR(i,5)
ELSE
?"Successful Transmit"
ENDIF
m.ComSend=FPUTS(m.Com,m.StartChar,LEN(m.StartChar)+2)
ENDDO
CLOSE ALL
An Intelligent fool can make things bigger and more complex... It takes a touch of a genius -and a lot of courage- to move in the opposite direction".
-Albert Einstein
Précédent
Suivant
Répondre
Fil
Voir

Click here to load this message in the networking platform