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

Click here to load this message in the networking platform