wlxinxiang 发表于 2009-7-14 14:21:07

如何得到一个簇的首地址?

本帖最后由 wlxinxiang 于 2009-7-14 14:23 编辑

调用dll中遇到一个问题,函数体为:
long ScanInput_Start(long nCardID, PSCANINPUTREQUEST lpScanInputRequest, char *lpDataFileName);
dll中的第二个参数PSCANINPUTREQUEST 为struct :
typedef struct tagSCANINPUTREQUEST {
PSCANINPUTLIST pScanList;
USHORT wScanListCount; // Cannot be bigger than 512
AD_TRIGGER_MODE TriggerMode;
ULONG dwSampleRate; // Number of 0.1us. e.g. 50 means 5us, 100 means 10us
ULONG dwScanRepeatCycle; // Number of cycles of the scan. 0 means infinite
DATA_PROC_MODE DataDeliveryMode;
}SCANINPUTREQUEST, *PSCANINPUTREQUEST;
其中第一个参数为struct指针 :
typedef struct tagSCANINPUTLIST {
INPUT_SOURCE InputSource; // Indicates where the data is input from
ULONG dwChannelNum; // Channel number
AD_GAIN ADGain; // Gain for the specific A/D input channel
POLAR_TYPE PolarType; // Polar type for the specific A/D channel
}SCANINPUTLIST, *PSCANINPUTLIST;


我在labview 中用簇来代替struct,遇到一个问题,就是在获得簇的地址时不知如何搞定?若只获得内容无问题。

附:
vc调用过程:
ScanList.InputSource = Source_AD;
ScanList.dwChannelNum = 0;
ScanList.ADGain = Gain_2;
ScanList.PolarType = BiPolar;
//注意这里调用的是ScanList的地址
ScanRequest.pScanList = &ScanList;
ScanRequest.wScanListCount = 3;
ScanRequest.pDataFileName = &szDataFile;
ScanRequest.DataProcessingMode = Write_To_File_Only;
ScanRequest.dwScanRepeatCycle = 100;
ScanRequest.dwSampleRate = 20000; // 1 second
// m_aryCardIDs(0) is returned from ScanDevice function
nRet = ScanInput_Start(m_aryCardIDs(0), &ScanRequest, &szDataFile);

vb调用:
ScanList(0).InputSource = Source_AD
ScanList(0).wChannelNum = 0
ScanList(0).ADGain = Gain_2
ScanList(0).PolarType = BiPolar
'下面这个函数VarPtr获得的也是个地址
ScanRequest.pScanList = VarPtr(ScanList(0))
ScanRequest.wScanListCount = 3
ScanRequest.sFileName = "c:\Temp\tmp1\ScanData.txt"
ScanRequest.DataProcessingMode = Write_To_File_Only
ScanRequest.dwScanRepeatCycle = 100
ScanRequest.dwSampleRate = 20000 ‘‘ 1 second
‘‘ m_aryCardIDs(0) is returned from ScanDevice function
nRet = ScanInput_Start(m_aryCardIDs(0), VarPtr(ScanRequest))



还有一个小问题·:地址和句柄一样不?

wlxinxiang 发表于 2009-7-14 20:06:14

自己顶一下allqq-mogudiandian-48all
页: [1]
查看完整版本: 如何得到一个簇的首地址?