Level Extreme platform
Subscription
Corporate profile
Products & Services
Support
Legal
Français
Using serial port without writing to registry
Message
From
16/11/2004 09:05:12
 
 
To
16/11/2004 07:05:48
General information
Forum:
Visual FoxPro
Category:
Windows API functions
Miscellaneous
Thread ID:
00961648
Message ID:
00961671
Views:
14
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
Previous
Next
Reply
Map
View

Click here to load this message in the networking platform