Questions? Search our site or call us at 1-800-722-6004

Visual Fox Pro: Communicating with Devices through WinWedge

The following procedure demonstrates how to transmit a string out the serial port by sending a DDE command from FoxPro to WinWedge.

PROCEDURE TransmitTesting

CmdString="[SENDOUT('testing 123',13)]"
*** transmit the string "testing 123" followed by a carriage return (ascii 13)
gnChanNum = DDEInitiate('WinWedge', 'COM2')
IF gnChanNum != -1
glExecute = DDEExecute(gnChanNum, CmdString)
= DDETerminate(gnChanNum) && Close the channel
ENDIF

RETURN

*** the following procedure is a variation of the above procedure that transmits a 

*** string passed as a parameter to the procedure (gData) 

PROCEDURE TransmitData 

PARAMETERS gData
cmdstring="[SENDOUT(' " & gData & " ' )]"
*** transmit the string passed in the variable gData
*** note the use of both single and double quotes around the gData variable
*** refer to the syntax for the SENDOUT command in the Wedge manual for details
gnChanNum = DDEInitiate('WinWedge', 'COM2')
IF gnChanNum != -1
glExecute = DDEExecute(gnChanNum, CmdString)
= DDETerminate(gnChanNum) && Close the channel
ENDIF
RETURN

Categories: Macro / Code Sample, Other Applications, WinWedge

Last Updated: 2011.07.06

Need more help?

Don't hesitate to call or email us with your questions

Our office is open 9AM - 5PM Monday Through Friday (E.S.T.)

Technical Support: 215-496-0202

Toll-Free: 1 (800) 722-6004
Skype: taltech1 (Voice only)
Email: support@TALtech.com