Plateforme Level Extreme
Abonnement
Profil corporatif
Produits & Services
Support
Légal
English
Sending string to port com1:
Message
Information générale
Forum:
Visual FoxPro
Catégorie:
Contrôles ActiveX en VFP
Versions des environnements
Visual FoxPro:
VFP 6 SP5
OS:
Windows XP SP2
Network:
Windows 2000 Server
Database:
Visual FoxPro
Divers
Thread ID:
01025950
Message ID:
01026038
Vues:
25
Well, whereever i read it... it was wrong... i added a parameter (11) to your code and it worked fine!
lcstring = "TEST STRING"
lnhandle = FOPEN("COM1:",11)
?lnhandle
IF lnhandle <> -1
   Fwrite(lnhandle,lcstring,len(lcstring))
   FCLOSE(lnhandle)
ENDIF
Tanks a lot!!


>Nothing happens...
>
>I don´t remember where I read that comm ports can´t be opened with fopen() in VFP... (maybe in help files..)
>
>>Have you tried fopen?
>>
>>lcstring = "TEST STRING"
>>lnhandle = FOPEN("COM1:")
>>IF lnhandle <> -1
>>   FWRITE(lnhandle,lcstring,len(lcstring))
>>   FCLOSE(lnhandle)
>>ENDIF
>>
>>
>>
>>>Hi.
>>>I need to send a string to the communications port COM1:
>>>Is there any way other than adding a commcontrol to a form??
>>>
>>>I found a piece of code posted by Ed Rauh, (post # 12708):
>>>
>>>
>>>DECLARE INTEGER CopyFile IN KERNEL32.DLL ;
>>>   STRING @SourceFileName, ;
>>>   STRING @DestFileName, ;
>>>   INTEGER bFailIfExists
>>>IF CopyFile(cMySourceFileName,cMyPortOrUNC,0) # 0
>>>   *  It was copied
>>>ELSE
>>>   *  it wasn't
>>>ENDIF
>>>
>>>
>>>
>>>It sends a FILE, wich makes me to write a file containing the string i want to send... by now, it works for me.. but my doubt persists.. how can I send just a string??
>>>
>>>Thanks in advance.
Précédent
Suivant
Répondre
Fil
Voir

Click here to load this message in the networking platform