Please ensure Javascript is enabled for purposes of website accessibility
Powered by Zoomin Software. For more details please contactZoomin

AVEVA™ Plant SCADA

DDEhInitiate

  • Last UpdatedJul 18, 2023
  • 1 minute read

Starts a conversation with an external Windows application. When the data exchange is complete, you should terminate the conversation to free system resources.

Syntax

DDEhInitiate(sApplication, sDocument)

sApplication:

The application name (.EXE filename), for example, "WinWord".

sDocument:

The document, topic, or file name.

Return Value

An integer handle for the conversation between Plant SCADA and the other application, or -1 if the conversation is not started successfully. The handle is used by the other DDEh... functions, to identify the conversation.

DDEhExecute, DDEhRequest, DDEhPoke, DDEhTerminate, DDEhGetLastError

Example

! Read from Excel spreadsheet

STRING FUNCTION GetExcelData();

INT hChannel;

STRING sData;

hChannel = DDEhInitiate("EXCEL", "DATA.XLS");

IF hChannel > -1 THEN

sData = DDEhRequest(hChannel, "R1C1");

DDEhTerminate(hChannel);

hChannel = -1;

END;

RETURN sData;

END

! Write to Excel spreadsheet

FUNCTION SetExcelData(STRING sData);

INT hChannel;

hChannel = DDEhInitiate("EXCEL", "DATA.XLS");

IF hChannel > -1 THEN

DDEhPoke(hChannel, "R1C1", sData);

DDEhTerminate(hChannel);

hChannel = -1;

END;

END

! Execute Excel Macro

FUNCTION DoExcelMacro();

INT hChannel;

hChannel = DDEhInitiate("EXCEL", "DATA.XLS");

IF hChannel > -1 THEN

DDEhExecute(hChannel, "[RUN(^"TestMacro^")]");

DDEhTerminate(hChannel);

hChannel = -1;

END;

END

See Also

Dynamic Data Exchange Functions

In This Topic
TitleResults for “How to create a CRG?”Also Available in