DADiSP – ActiveX
Learn about the DADiSP ActiveX connection…
ActiveX is a broad term that generally refers to a Microsoft binary standard for sharing code and data between separate programs or “components”. The actual protocol is specified by the Component Object Model (COM). COM has undergone many upgrades and enhancements since its original introduction as Object Linking and Embedding (OLE).
One important feature of COM is Automation. Automation allows a “client” program to control a “server” or component program just as if the component functionality was built into the client. For example, DADiSP can fully control Microsoft Word, placing a DADiSP Worksheet into a document and printing the results all from within DADiSP. Likewise, a Visual Basic program can hand off data to DADiSP for processing without DADiSP ever being visible to the user. In this way, DADiSP acts as a powerful data analysis library for any program that supports Automation.
ActiveX components generally expose three basic constructs:
Properties represent the various settings of the component such as color, font, size, etc.
Events are notifications the component makes to the client program. Some possible events are mouse was clicked, canvas was sized, button was pushed, etc. After receipt of the notification, the client can respond appropriately.
Methods are functions the client program can direct the component to execute.
DADiSP Automation Server
DADiSP as an ActiveX server or component supports several extremely powerful methods, including:
- Getdata (window or variable)
- Putdata (window or variable, data)
- Execute (“command string”)
Getdata retrieves data from a DADiSP Window or variable to the client. For example, here’s a Visual Basic code fragment that obtains the series in W2 of a DADiSP Worksheet into a Visual Basic variable:
In this example, Visual Basic acts as the “client” and DADiSP the ActiveX “server”.
We declare DADiSP as an ActiveX object with the
Dim DADiSP As Object
declaration. Visual Basic establishes a connection to DADiSP with the
Set DADiSP = CreateObject("DADiSP.Application")
statement. The connection is made by checking the Registry for ActiveX components and capabilities. For faster ActiveX communication, DADiSP also provides a COM “Type Library” (
dadisp.tlb) that provides in depth information on the ActiveX capabilities offered by DADiSP. Finally,
VbVar = DADiSP.Getdata("W2")
copies the series or table in W2 into the Visual Basic array
VbVar. ActiveX data transfers are quite flexible and efficient. DADiSP transparently supports multi-column data using the COM standard
SafeArray. Byte, Integer, Float, and Double scalar values are also supported.
Here’s a code fragment that generates a Visual Basic array and then transfers the array to DADiSP.
You can also “get” or “put” data to a DADiSP variable. For example:
Execute accepts any valid DADiSP command as input, all the features, functions and capabilities of DADiSP are available to any program that supports ActiveX Automation.
Now for a full example of ActiveX with Visual Basic controlling DADiSP. We’ll use each of the above methods to 1) create data in VB, 2) transfer it to DADiSP, 3) use DADiSP to process the data and 4) retrieve the processed result from DADiSP.
DADiSP.Visible = 1
You could also use the DADiSP SETVISIBLE function:
DADiSP Automation Client
So far, we’ve shown examples of controlling DADiSP from Visual Basic. In this case, Visual Basic is the “client” and DADiSP acts as the ActiveX “server”. However, DADiSP can also function as an ActiveX client to control and make use of the features of ActiveX servers such as Excel, Word, database programs or data acquisition drivers.
The DADiSP SPL syntax for ActiveX is very similar to the Visual Basic syntax mentioned above. For example, to connect to an ActiveX object, you use the
CreateObject function. Properties can be set and retrieved with standard variable assignments and methods executed with the “dot” syntax. For example, the following SPL code fragment connects to Word and makes it visible:
DADiSP can access any function exposed by the ActiveX Automation server. For example, Word has a very elaborate ActiveX hierarchy, consisting of Documents, Ranges, Tables and a host of other objects all accessible to DADiSP.
Finally, the full SPL example below demonstrates the use of these objects to create and copy a DADiSP Worksheet to a Word document.
In conclusion, ActiveX is a very powerful, standardized means of sharing the capabilities of separate programs in a flexible and robust manner. The
SPLActiveX subdirectory included with your DADiSP distribution provides several additional examples of using ActiveX with DADiSP.
Hier geht es weiter
Sie möchten kaufen?
Was sagen unsere Kunden über uns?
I have greatly appreciated your help, your restraint in response to some daft questions and your sheer professionalism.PL, Tunbridge Wells, UK
Thanks very much for all your time, it was really appreciated. As always Adept has been my number one company!MA, Crawley, UK
Excellent! Very much appreciated how the content was tailored to our needs.
Very helpful in providing advice on which courses were applicable. Very clear. Checked with trainees to ensure the pace was accurate. Very aware of individual needs of trainees without letting individual issues take over. My interaction with Adept has always been very good. Staff are helpful, efficient and responsive.Dr C Stott, Cambridge, UK
Zur Zeit ist es uns leider nicht möglich die folgenden Produkte anzubieten. Wir arbeiten jedoch daran Ihnen ein möglichst vielfältiges Produktsortiment zur Verfügung zu stellen. Bitte kontaktieren Sie uns wenn Sie Fragen oder Anregungen haben.