>>Hi there,
>>
>>I want to send data through the com-port to a customer-display.
>>I know that I can use mscoom.ocx or something similar but as I am trying
>>to avoid using controls I was wondering if there is a win-api I could use directly?
>>
>>Thanks in advance
>>
>>Thomas
>
>There was track D-TIP1 on the DFPUG DevCon 2016, doing the job with WIN32API. PM me, if you need it.
>
>Lutz
some of the API declarations you'll need are:
DECLARE LONG CreateFile IN WIN32API ;
STRING cPortName, LONG nAcess, LONG nShare, STRING cSecurity, ;
LONG nCreate, LONG nAttrib, LONG nTemplate
DECLARE LONG CloseHandle IN WIN32API LONG nHandle
DECLARE LONG ReadFile IN WIN32API ;
LONG nHandle, STRING @cBuf, LONG nLen, LONG @nRead, STRING @cOverlap
DECLARE LONG WriteFile IN WIN32API ;
LONG nHandle, STRING cBuf, LONG nLen, LONG @nWrite, STRING @cOverlap
DECLARE LONG FlushFileBuffers IN WIN32API LONG nHandle
DECLARE LONG PurgeComm IN WIN32API LONG nHandle, LONG nAction
DECLARE SHORT SetCommState IN WIN32API LONG nHandle, STRING cDCB
DECLARE SHORT GetCommState IN WIN32API LONG nHandle, STRING @cDCB
DECLARE SHORT EscapeCommFunction IN WIN32API LONG nHandle, LONG nFunc
DECLARE LONG GetLastError IN WIN32API
DECLARE LONG GetCommTimeouts IN WIN32API ;
LONG nHandle, STRING @cTmOutStruc
DECLARE LONG SetCommTimeouts IN WIN32API ;
LONG nHandle, STRING @cTmOutStruc
DECLARE LONG GetCommMask IN WIN32API LONG nHandle, LONG @nMask
DECLARE LONG SetCommMask IN WIN32API LONG nHandle, LONG nMask
DECLARE LONG WaitCommEvent IN WIN32API ;
LONG nHandle, LONG @nMask, STRING @cOverlap
DECLARE LONG SetCommBreak IN WIN32API LONG nHand
DECLARE LONG ClearCommBreak IN WIN32API LONG nHand
DECLARE LONG CancelIo IN WIN32API LONG nHand
Yep. I've written some code using API calls for serial, and wrote a similar one for winsock too. Unfortunately can't give out the code (as the code is considered property of my employer). The VFP code was near complete rewrite of the code I originally wrote for FPW (this was necessitated by a very different API). One warning however -- going this route is probably not for the faint of heart, and does require some familiarity with C/C++ (since most API examples are for that language, and you'll need to refer to many of the #define from several .h files from the C/C++ compiler).