Plateforme Level Extreme
Abonnement
Profil corporatif
Produits & Services
Support
Légal
English
Using serial port without writing to registry
Message
De
16/11/2004 09:05:12
 
 
À
16/11/2004 07:05:48
Information générale
Forum:
Visual FoxPro
Catégorie:
Fonctions Windows API
Divers
Thread ID:
00961648
Message ID:
00961671
Vues:
13
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
Précédent
Suivant
Répondre
Fil
Voir

Click here to load this message in the networking platform