DDE and ZOS-API

This article is part of the Getting Started with ZOS-API free tutorial.

This article explains the difference between DDE Extensions and ZOS-API and provides help on how to make the transition smoothly from DDE Extensions to ZOS-API.

Authored By Sandrine Auriol

Introduction

Like ZOS-API, a DDE Extension allows a Windows program to establish a communication link with OpticStudio, and for this other program to get data from OpticStudio on the lens.

DDE Extension and OpticStudio

DDE Extensions can be found in the OpticStudio interface under Programming…Extension List:

DDE

DDE Extensions have been superseded by ZOS-API. For more information, check the Help Files: The Programming Tab>About Extensions>Introduction (about extensions).

What communication protocol is used by DDE Extensions and ZOS-API?

When using a DDE Extension, the communication between the application and OpticStudio is accomplished using Dynamic Data Exchange (DDE). DDE is a protocol defined within the Windows operating system for sharing data between programs. Microsoft has superseded the DDE protocol via the newer Object Linking and Embedding (OLE) toolkit, but DDE is still supported by Office applications. For more information: https://docs.microsoft.com/en-us/windows/desktop/dataxchg/about-dynamic-data-exchange.

ZOS-API relies on a Component Object Model (COM) interface. Quote from https://docs.microsoft.com/en-us/windows/desktop/com/component-object-model--com--portal: “COM is a platform-independent, distributed, object-oriented system for creating binary software components that can interact. COM is the foundation technology for Microsoft's OLE (compound documents) and ActiveX (Internet-enabled components) technologies.

ZOS-API is rooted in .NET libraries. Programming with the API can be done using either COM or .NET languages, depending on the user’s comfort with either language. https://docs.microsoft.com/en-us/windows/desktop/learnwin32/what-is-a-com-interface-

Why is DDE replaced by ZOS-API ?

DDE is a very old technology that is no longer recommended by Microsoft. It is brittle – any single application can interfere with all other applications even with Microsoft’s own applications. There isn’t generally any way to work around it other than closing the problem application. Furthermore complex communication via DDE is difficult to implement and often requires a great deal of maintenance.

.NET is a modern language that makes it relatively easy to pass arbitrary data between applications, and is designed to be used in an object-oriented environment.  This means we can encapsulate in classes/properties/methods, and organize the API in a hierarchical manner, both of which would be difficult or impossible with DDE.  It is also easier and more efficient to program, which makes it viable to expose all OpticStudio functionality via the ZOS-API.

Transition

Starting with OpticStudio 15, DDE Extensions have been deprecated. No new capabilities or bug fixes are provided from that release onward.
It is highly recommended that any users that wish to write their own application to work with OpticStudio use ZOS-API. It is a much more powerful tool based on the latest available programming technologies.
To help the conversion from DDE to ZOS-API, here is a table mapping the old DDE data items to the new ZOS-API methods: Mapping DDE data items to ZOS-API methods

FAQ

How to “PushLens” with ZOS-API?

For DDE Extensions, “PushLens” will take the lens currently loaded in the server's memory and push it into the Lens Data Editor.
In ZOS-API this can be done:

  • In the Interactive Extension mode. The LDE is automatically updated.
  • In ZOS-API Extensions compiled as executables.

The user can either choose to automatically update the OpticStudio UI as changes are made, or to suppress changes. This setting can be changed at any time from within the extensions. By default, ZOS-API Extensions execute on the currently open lens file, but the user can choose to work on a temporary system instead, which will not affect the primary system.
Please see the help file section entitled “Plug-In/Extension” (The Programming Tab > About the ZOS-API > Plug-In/Extension).

How to “GetRefresh” with ZOS-API?

For DDE Extensions, “GetRefresh” will cause OpticStudio to copy all lens data (wavelengths, fields, editors, etc.) into the stored copy of the server. The lens is then updated, which means OpticStudio recomputes all pupil positions, solves, and index data.

In ZOS-API, retrieving the lens data from ZOS to the application is done manually by reaching into class properties (i.e. the ILDERow class) and retrieving the lens data.   

KA-01816

Was this article helpful?
0 out of 1 found this helpful

Comments

0 comments

Article is closed for comments.