Home > Back-end >  BCB call Vc write Ocx, the variables can be corresponding COleSafeArray the Vc
BCB call Vc write Ocx, the variables can be corresponding COleSafeArray the Vc

Time:10-26

Invoke the symbol ssiconnect. Ocx encountered one function
Typedef/* [wire_marshal] */struct tagVARIANT VARIANT;
Long __fastcall GetDecodeData (VARIANT * DecodeData, short Type, short * SSICode);

In the VC routine DecodeData COleSafeArray this type is used the me for a long time also do not understand, that can replace this variable in BCB?
COleSafeArray sa;
Psa COleSafeArray *=& amp; Sa;
Unsigned char * ptmpbuf;
Short code.

Sa. The Clear ();

M_ssi. GetDecodeData (psa, VT_UI1, & amp; Code);

CodePudding user response:

COleSafeArray inheritance from the VARIANT, can be used into the VARIANT object,

CodePudding user response:

I directly use the VARIANT to like, but there is no return value COleSafeArray is supposed to be a safe array:
TagVARIANT varChunk;
SAFEARRAY * psa;
SAFEARRAYBOUND rgsabound [1].
Rgsabound [0]. CElements=100;
Rgsabound [0]. LLbound=0;

Psa=SafeArrayCreate (VT_UI1, 1, rgsabound);

VarChunk. N=VT_ARRAY | VT_UI1;
VarChunk. Parray=psa;
Short tt;
SafeArrayLock (psa);
Long len=SSIConnect1 - & gt; GetDecodeData (& amp; VarChunk VT_UI1, & amp; Tt);
SafeArrayUnlock (psa);
Unsigned char pReceData [512].
Memset (pReceData, 0, sizeof (pReceData));
Long I=0;

Strcpy (pReceData, (unsigned char *) varChunk parray - & gt; PvData);

SafeArrayDestroy (psa);
Still no please comment

CodePudding user response:

How much is the GetDecodeData later, the return value len? OCX provide documentation of what the developer divide?

CodePudding user response:

Len always returns 0 should be returned normal scan data length,
Visual Basic programmers will set the Type parameter to vbString. Vc + + programmers can set the parameter to VT_BSTR or they may wish to set it to VT_UI1 if DecodeData is expected to contain binary data.

Another document:
He type specifiers is men because over the Visual Basic designed may file the
The data using a vbString, Visual c + + programmers use a data type specifiers of VT_UI1, and
DecodeData whenever a pointer to the ColeSafeArray, allowing the returned data to be
Manipulated as an array of unsigned character.

CodePudding user response:

I tried on the Vb does return to the correct values, I intentionally vbString changed to other values of the parameter, the return value to 0,
  • Related