Plateforme Level Extreme
Abonnement
Profil corporatif
Produits & Services
Support
Légal
English
API functions with structures
Message
Information générale
Forum:
Visual FoxPro
Catégorie:
Fonctions Windows API
Divers
Thread ID:
00842537
Message ID:
00843629
Vues:
25
Hi Anatoliy,
Your suggestions helped a lot. I was able to open the port and communicate with the serial device. Now I am struggling to get (verify) the serial number.

Thanks,
Yiorgos



>Hi Yiorgos.
>
>You did not indicate what members this structure consists of.
>Let, for example, define it as follows:
>typedef struct _STRUCTDEV {
>  DWORD iType;
>  WORD wPort;
>  CHAR strSerialNo[11];
>} STRUCTDEV;
>An equivalent FoxPro code should be something like this:
>#DEFINE SDTYPE_SERIAL 0x0001
>
>DECLARE INTEGER FSL_SelectDevice IN <dll name>;
>	STRING @dev, STRING param2
>
>LOCAL cBuffer, nType, nPort, cSerial
>nType = SDTYPE_SERIAL
>nPort = 1
>cSerial = "ABC02000001"
>
>cBuffer = PADR(Chr(nType), 4, Chr(0)) +;
>	PADR(Chr(nPort), 2, Chr(0)) +;
>	cSerial
>
>nResult = FSL_SelectDevice(@cBuffer, "any string")
>
>If the structure has different definition than you have to make corresponding changes in the way you populate cBuffer.
Précédent
Suivant
Répondre
Fil
Voir

Click here to load this message in the networking platform