The Origin Forum
File Exchange
Try Origin for Free
The Origin Forum
Home | Profile | Register | Active Topics | Members | Search | FAQ | Send File to Tech support
 All Forums
 Origin Forum for Programming
 Forum for Origin C
 Is ColeSafeArray the only way ?

Note: You must be registered in order to post a reply.
To register, click here. Registration is FREE!

Screensize:
UserName:
Password:
Anti-Spam Code:
Format Mode:
Format: BoldItalicizedUnderlineStrikethrough Align LeftCenteredAlign Right Horizontal Rule Insert HyperlinkUpload FileInsert Image Insert CodeInsert QuoteInsert List
   
Message:

* HTML is OFF
* Forum Code is ON
Smilies
Smile [:)] Big Smile [:D] Cool [8D] Blush [:I]
Tongue [:P] Evil [):] Wink [;)] Clown [:o)]
Black Eye [B)] Eight Ball [8] Frown [:(] Shy [8)]
Shocked [:0] Angry [:(!] Dead [xx(] Sleepy [|)]
Kisses [:X] Approve [^] Disapprove [V] Question [?]

 
Check here to subscribe to this topic.
   

T O P I C    R E V I E W
cosy Posted - 04/20/2004 : 04:40:54 AM
Hi,
I use, as in the sample code for Automation server in vc++, the "COlesafearray method" to send data to Origin.My application needs to send data in real time - the data rate being around 1ms. The number of data being sent is random. This poses a problem. Colesafearray requires that the array size be defined prior to filling of data in the array.
COleSafeArray csa;
DWORD bounds[] = {250, 18} ;
csa.Create(VT_R8, 2, bounds);
But I need a array thats "flexible",which needs no prior definition of its size as my datasize (i.e., the number of rows) varies each time
How do I overcome this.Is there anyway out.
I also found that this method is slower that the DDE transfer !
Thanks,
Deepak Samuel.
1   L A T E S T    R E P L I E S    (Newest First)
cpyang Posted - 04/20/2004 : 10:50:33 AM
1. COleSafeArray is the only way to pass data via COM, but I don't quite understand the reason of your question. The example we created was using dynamic array size, as can be seen below,


COleSafeArray csa;
DWORD bounds[2] = {m_nRows, m_nColumns};
csa.Create(VT_R8, 2, bounds);

long index[2];
UINT nLowerBound = nRowStart;
UINT nUpperBound = m_nRows + nRowStart;

for( UINT ii=0; ii < m_nColumns; ii++ )
{
for( UINT jj=0; jj < m_nRows; jj++ )
{
index[0]=jj;
index[1]=ii;

double fVal = 0.0;
if( ii == 0 )
fVal = nLowerBound + jj + 1;
else
fVal = ((nLowerBound + jj + 1) * 10 + ii) * rand()/RAND_MAX;

csa.PutElement(index, &fVal);
}
}

//Put generated numeric data into Origin
m_pClient->SetWorksheet(m_strWksName, csa, nRowStart);



2. As for slower speed then DDE, that might be a different issue. The updating of graphs might be the reason. In DDE, there were realtime mode where the graph will not be redrawn, but only the data is appended to the graph. This mechanism is not yet implemented in the COM data transfer, so you might be seeing a complete redraw of your graph which will be slower. Try making the graph minimized and see if speed is better.

CP




Edited by - cpyang on 04/20/2004 11:05:08 AM

The Origin Forum © 2020 Originlab Corporation Go To Top Of Page
Snitz Forums 2000