Measurement Studio for VB6

cancel
Showing results for 
Search instead for 
Did you mean: 

Acquire Binary Codes with CWAI

Hello,
does anybody know how to access binary codes with the CWAI1AcquiredData
event with Component Works 2.0 ?

I tried to do this as similar like accessing ScaledData in the example I
found in the NI Knowledge base but with Binary Codes I get a run time error
"Data is not an array"

void __fastcall TForm1::CWAI1AcquiredData(TObject *Sender,
void *ScaledData_which_is_really_a_Ptr_to_TVariant,
void *BinaryCodes_which_is_really_a_Ptr_to_TVariant)
{
double f;
float *pArrayVar;
Variant *pScaledData;

pScaledData =
(Variant*)ScaledData_which_is_really_a_Ptr_to_TVariant;

// Use Borland Helper function to access the array inside the
Variant

pArrayVar = (float *)VarArrayLock(*pScaledData);


f = (float)pArrayVar[0];

// Release the array reference when you are done
VarArrayUnlock(*pScaledData);

Does anybody know how it works ?

Thanks for your help.

Marko Muller
0 Kudos
Message 1 of 2
(3,460 Views)
Marko,

My guess is that you have not enabled the event to return the binary codes.
In the Buffer property page of the CWAI control, you can specify the return
data type for the AcquiredData event. You should select either binary data
or scaled data and binary data. The default is to just return the scaled
data. Once this is set correctly, you should be able to access the data
in the same way as the scaled data.

Denise

"Marko Müller" wrote:
>Hello,>does anybody know how to access binary codes with the CWAI1AcquiredData>event
with Component Works 2.0 ?>>I tried to do this as similar like accessing
ScaledData in the example I>found in the NI Knowledge base but with Binary
Codes I get a run time error>"Data is not an array">>void __fastc
all TForm1::CWAI1AcquiredData(TObject
*Sender,> void *ScaledData_which_is_really_a_Ptr_to_TVariant,>
void *BinaryCodes_which_is_really_a_Ptr_to_TVariant)>{>double f;>float *pArrayVar;>Variant
*pScaledData;>> pScaledData =>(Variant*)ScaledData_which_is_really_a_Ptr_to_TVariant;>>
// Use Borland Helper function to access the array inside the>Variant>>
pArrayVar = (float *)VarArrayLock(*pScaledData);>> f = (float)pArrayVar[0];>>
// Release the array reference when you are done> VarArrayUnlock(*pScaledData);>>Does
anybody know how it works ?>>Thanks for your help.>>Marko Muller>>>>
0 Kudos
Message 2 of 2
(3,460 Views)