Home > Software engineering >  How to get the number of type double wrapped in COleSafeArray types of variable
How to get the number of type double wrapped in COleSafeArray types of variable

Time:09-27

, for example, there are a number of type double 100, want to transfer to COleSafeArray saValues in do??
This is me to write a program const int knMaxAtOnce=1;
Int nStartIndex=19;
Int nVarIndex;
NVarIndex=1;
Double dValue;
BOOL bOK=TRUE;
Cstrings strValue;
COleSafeArray saValues;
DWORD dwElements [1].
LPTSTR pStrz;
Double * pdValue;

DwElements [0]=knMaxAtOnce;
SaValues. Create (VT_VARIANT, 1, dwElements);
SaValues. AccessData (* *) (void & amp; PdValue);
* pdValue=https://bbs.csdn.net/topics/100;
SaValues. UnaccessData ();
Mytrio. SetTable (nStartIndex nVarIndex, saValues);
In the last sentence to set breakpoints, saValues no I want to deposit 100

CodePudding user response:

 
Int iNums=100;

Double double * pData=https://bbs.csdn.net/topics/new [iNums];
for(int i=0; i{
PData [I]=I;
}

COleSafeArray ar;
Ar. CreateOneDim (VT_R8 iNums, pData);

.

The delete [] pData;

CodePudding user response:

reference 1st floor zgl7903 response:
 
Int iNums=100;

Double double * pData=https://bbs.csdn.net/topics/new [iNums];
for(int i=0; i{
PData [I]=I;
}

COleSafeArray ar;
Ar. CreateOneDim (VT_R8 iNums, pData);

.

The delete [] pData;

Still won't do, CreateOneDim is to create a dimension, and iNums is 100, 100 d, pData is to store the number of each dimension;

CodePudding user response:

Int iNums=1;

Double double * pData=https://bbs.csdn.net/topics/new [iNums];
for(int i=0; i{
PData [I]=I;
}

COleSafeArray ar;
Ar. CreateOneDim (VT_R8 iNums, pData);

.

The delete [] pData;

CodePudding user response:

Double f=100;
COleSafeArray ar;
Ar. CreateOneDim (VT_R8, 1, & amp; F);
  • Related