Access properties/variables in a .COM DLL - guidance please

Questions about MultiCharts and user contributed studies.
johnromeronc
Posts: 53
Joined: 18 Feb 2011
Has thanked: 11 times
Been thanked: 13 times

Access properties/variables in a .COM DLL - guidance please

Postby johnromeronc » 11 Feb 2012

I think I am close, but not there. This is my first attempt at this, so any help is appreciated. I have read the TS SDK doc. I have also looked at some samples used to call functions to put data in Execel SS.

I am trying to access a set of routines in a a COM-server (DLL). I do not have the source, nor am I allowed to share, as it is licensed sw.

My question is around accessing some of the propoerties / variables in the DLL.

My thanks up front for any who will provide guidance.


The DLL is called MyDLLFile and the "main" is called MyCodeMain



1) Is the below lines of code right?

2) Do I need to define this anywhere first?

3) Do I need to create the OLE link first?


external: "c:\MyDlls\MyDLLFile.dll", double,"MyFunction_1", int ;
external: "c:\MyDlls\MyDLLFile.dll", integer,"MyFunction_2", boolean ;


Below is where I am guessing from looking at other examples.
I think I need to establish a link into my dll and then use the vObj.name (or something similar) as the way to read / write the fields / values.


vObj := CreateOleObject('MyCode.Main');
vObj.SourceSeries[1] := my calculations for this element of the array;



Here are the definitions of two fields I would like to know how to put data into.

HRESULT SourceSeries (VARIANT*);
definition -->The initial time series. Should be SAFEARRAY (VT_ARRAY|VT_R8)


HRESULT SelectedPC (long Index, BOOL newVal);
Definition --> Sets the principal components numbers to apply for reconstruction.
example in Delphi--> for I := 1 to 3 do MyCode.SelectedPC := True ;

User avatar
Henry MultiСharts
Posts: 9165
Joined: 25 Aug 2011
Has thanked: 1264 times
Been thanked: 2957 times

Re: Access properties/variables in a .COM DLL - guidance ple

Postby Henry MultiСharts » 13 Feb 2012

Hello Johnromeronc,

Here is a sample for Q1 and Q2:

Code: Select all

inputs: name(StringSimple);
DefineDLLFunc: "GlobalVariable.dll", string, "GV_GetNamedString",string;
GV_GET_String = GV_GetNamedString(name);
You need to use SDK to transfer arrays and links to them in a dll.
You can find the description in TS sdk guide.
There are some key topics using it:
1) You need to use SDK to transfer the link to the array address in the memory.
2) You can simply transfer the values using the txt line. Text line is essentially an array-an array of symbols.


Return to “MultiCharts”