Level Extreme platform
Subscription
Corporate profile
Products & Services
Support
Legal
Français
Sending string to port com1:
Message
General information
Forum:
Visual FoxPro
Category:
ActiveX controls in VFP
Environment versions
Visual FoxPro:
VFP 6 SP5
OS:
Windows XP SP2
Network:
Windows 2000 Server
Database:
Visual FoxPro
Miscellaneous
Thread ID:
01025950
Message ID:
01026038
Views:
26
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.
Previous
Next
Reply
Map
View

Click here to load this message in the networking platform