Link to home
Start Free TrialLog in
Avatar of dssisupport
dssisupport

asked on

Pointer to javascript data structure

I have a web application that uses a third party activeX control to perform various functions using java scripting. One of the functions parameters (settings) requires the passing of a pointer to a data structure that would be similar to how it is done in vb. Below is the vb code example of the data structure and the call to the function. My question is how can I implement something similar in java script. The third party vendor said it should be possible but they are not sure how to code it.

Visual Basic structure definition
 

Public Type WANALYZER_HORIZONTAL_LINE
         color As OLE_COLOR
         nChannel As enumHorizontalLineChannel
         nDashStyle As enumWaveformLineDashStyles
         nHeightInPix As Integer
         nTranspFactor As Integer
         nVertPosInPerc As Integer
         nLeftCap As enumLineCaps
         nRightCap As enumLineCaps
         nDashCap As enumLineDashCaps
End Type

[Visual Basic function]

control.WaveformAnalzyer.GraphicItemHorizontalLineAdd (
strFriendlyName as String,
strDescription as String,
nStartPosInMs as Long,
nEndPosInMs as Long,
settings as Long (Address of a structure of type WANALYZER_HORIZONTAL_LINE )
) as Integer
SOLUTION
Avatar of Dave Baldwin
Dave Baldwin
Flag of United States of America image

Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial
Avatar of dssisupport
dssisupport

ASKER

I was afraid someone might say that. I have been able to implement all of their other functions but this one. It is the only one that requires passing the data structure as a long. I will leave this open for a while to see if anyone else has any ideas.
Are you looking for a sort of converter that changes the declarations from VB to JS...?
I guess that might work. Here is what the vendor said:

creating graphic items requires the usage of data structures which are available in most development languages: the data structure is then passed to the method by passing the pointer to the memory buffer which contains the data structure itself; we are not JavaScript experts so we are not aware if JavaScript allows passing pointers to methods.
For example in VB6 you can create a data structure through the "Type" keyword then the data structure can be passed to the method using the "VarPtr" statement: may be that you have knowledge about this possibility in JavaScript?
I took a look at your links but unless I am missing something I don't think this will help. Basically, I have to create a data structure, which I could easily do by creating an array with all of the required parameters, and then pass a pointer (long) to the memory buffer where that array is stored to the function. How do I get the value of the pointer?
ASKER CERTIFIED SOLUTION
Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial