Plateforme Level Extreme
Abonnement
Profil corporatif
Produits & Services
Support
Légal
English
Problem communicating with Digital I/O Card
Message
Information générale
Forum:
Visual FoxPro
Catégorie:
Fonctions Windows API
Divers
Thread ID:
00395294
Message ID:
00395303
Vues:
11
>Hi everyone,
>
>I'm trying to communicate with an I/O card ( modell Advantech PCL-725 ) , but all the samples in the documentation is for Visual C++, Visual Basic, Borland C++ and Borland Delphi.
>The sampleprogram I am looking at is the one for VB, because my knowledge in the other languages is about ZERO ( and for VB just a little bit better ). All communications with the
>I/O-card is done thru DLL- calls to ADSAPI32.DLL.
>
>The main problems is:
>
>1. Syntax for DLL declarations
>2. Samples for VB use structures. How do I use structures in VFP ?
>
>
>Can someone help me with these two declarations and tell me how it should be done in VFP (there are about 30 more to fix , but I hope
>that help with these two , might make it possible for me to fix the main part of the rest myself).
>
>
>
>Declare Function DRV_SelectDevice Lib "adsapi32.dll" (ByVal hCaller As Long, ByVal GetModule As Boolean, DeviceNum As Long, ByVal Description As String) As Long
>

DECLARE INTEGER DRVSelectDevice IN ADSAPI32.DLL ;
INTEGER hCaller, ;
INTEGER GetModule, ;
INTEGER DeviceNum, ;
STRING Description

>Declare Function DRV_DeviceGetFeatures Lib "adsapi32.dll" (ByVal DriverHandle As Long, lpDevFeatures As PT_DeviceGetFeatures) As Long
>

DECLARE INTEGER DRV_DeviceGetFeatures IN ADSAPI32.DLL ;
INTEGER DriverHandle, ;
STRING @ PTDeviceGetFeatures

You'll have to pre-construct a string of sufficient length to pass to this API call, pass it by reference using the @ prefix in the function call for the second parameter, and then deconstruct the string into its components. You can use the UDFs in my CLSHEAP class to help deconstruct and retrieve the contents of memory passed back through pointers; Christof Lange's STRUCT class may allow you to implement the structures via a class and make the deconstruction of the returned value easier. Both classes can be downloaded from the Files Section here on UT.

>
>
>
>Some of the code from module Code.bas :
>
>Type PT_DEVLIST
> dwDeviceNum As Long
> szDeviceName(0 To 49) As Byte
> nNumOfSubdevices As Integer
>End Type
>
>Type PT_DeviceGetFeatures
> buffer As Long ' LPDEVFEATURES
> size As Integer
>End Type
>
>Type DEVFEATURES
> szDriverVer(0 To 7) As Byte ' device driver version
> szDriverName(0 To (MAX_DRIVER_NAME_LEN - 1)) As Byte ' device driver name
> dwBoardID As Long ' board ID
> usMaxAIDiffChl As Integer ' Max. number of differential channel
> usMaxAISiglChl As Integer ' Max. number of single-end channel
> usMaxAOChl As Integer ' Max. number of D/A channel
> usMaxDOChl As Integer ' Max. number of digital out channel
> usMaxDIChl As Integer ' Max. number of digital input channel
> usDIOPort As Integer ' specifies if programmable or not
> usMaxTimerChl As Integer ' Max. number of Counter/Timer channel
> usMaxAlarmChl As Integer ' Max number of alram channel
> usNumADBit As Integer ' number of bits for A/D converter
> usNumADByte As Integer ' A/D channel width in bytes.
> usNumDABit As Integer ' number of bits for D/A converter.
> usNumDAByte As Integer ' D/A channel width in bytes.
> usNumGain As Integer ' Max. number of gain code
> glGainList(15) As GainList ' Gain listing
> dwPermutation(3) As Long ' Permutation
>End Type
>
>
>Code from module Global.bas :
>
>Global Const MaxEntries = 255
>Global DeviceHandle As Long
>Global ptDevGetFeatures As PT_DeviceGetFeatures
>Global lpDevFeatures As DEVFEATURES
>Global devicelist(0 To MaxEntries) As PT_DEVLIST
>Global SubDevicelist(0 To MaxEntries) As PT_DEVLIST
>Global ErrCde As Long
>Global szErrMsg As String * 80
>Global bRun As Boolean
>
>Global lpDioPortMode As PT_DioSetPortMode
>Global lpDioReadPort As PT_DioReadPortByte
>Const ModeDir = 0 ' for input mode
>
>
>Thanks in advance
>
>Torgny
EMail: EdR@edrauh.com
"See, the sun is going down..."
"No, the horizon is moving up!"
- Firesign Theater


NT and Win2K FAQ .. cWashington WSH/ADSI/WMI site
MS WSH site ........... WSH FAQ Site
Wrox Press .............. Win32 Scripting Journal
eSolutions Services, LLC

The Surgeon General has determined that prolonged exposure to the Windows Script Host may be addictive to laboratory mice and codemonkeys
Précédent
Suivant
Répondre
Fil
Voir

Click here to load this message in the networking platform