Roberto, thank you.
This code works even in Windows 98.
Do you have an example how to write a data and read result from COM port ?
>if you want, read this article
http://msdn.microsoft.com/library/default.asp?url=/library/en-us/dnfiles/html/msdn_serial.asp>
>And, try with this example.
>
>Regards,
>
>---------------------------------------------------------------------------------------
>DO decl
>? "Testing port COM1:", TestPort("COM1")
>? "Testing port COM2:", TestPort("COM2")
>? "Testing port COM3:", TestPort("COM3")
>? "Testing port COM4:", TestPort("COM4")
>
>FUNCTION TestPort (lcPort)
>#DEFINE OPEN_EXISTING 3
>#DEFINE GENERIC_READ 2147483648 && 0x80000000
>#DEFINE FILE_FLAG_OVERLAPPED 1073741824 && 0x40000000
>#DEFINE INVALID_HANDLE_VALUE -1
>
> LOCAL hPort
> hPort = CreateFile (lcPort, GENERIC_READ, 0,0,;
> OPEN_EXISTING, FILE_FLAG_OVERLAPPED, 0)
>
> = CloseHandle(hPort)
>RETURN (hPort <> INVALID_HANDLE_VALUE)
>ENDPROC
>
>PROCEDURE decl
> DECLARE INTEGER CreateFile IN kernel32;
> STRING lpFileName, INTEGER dwAccess, INTEGER dwShareMode,;
> INTEGER lpSecurityAttr, INTEGER dwCreationDisp,;
> INTEGER dwFlagsAndAttr, INTEGER hTemplateFile
>
> DECLARE INTEGER CloseHandle IN kernel32 INTEGER hObject
>ENDPROC
Andrus