Please enable JavaScript to view this site.

ESL Documentation

A stimulus library must conform to the following specifications, in addition to those required for a normal ESL for Windows DLL.

 

The DLL must export two entry points as ordinals 1 and 2, which will be used, respectively, for initialization and termination. Each entry point must be an APIENTRY (e.g., "standard call") function and must return an integer 0.

The DLL must export a third entry point as ordinal 3, which is called by ESL approximately nine times per second. This entry point must be an APIENTRY (e.g., "standard call") function returning type "void" (e.g., no return value). For some stimulus libraries, this function need not do anything except return immediately. For others, this function is needed for testing the status of a device or other resource, to determine if an event needs to be generated. This function should not perform extensive processing.

The initialization routine is called by ESL for Windows immediately after loading the first application that references the DLL as a stimulus. The initialization routine must take a single argument, which is a Windows window handle (HWND). This window handle is used for passing stimulus events to the ESL program.

The termination routine must take the same Windows window handle as an argument. The termination routine is called just before exiting from the ESL for Windows runtime, giving the DLL a chance to perform any necessary cleanup operations.

The DLL may have additional entry points to be called explicitly by the ESL for Windows developer. Refer to Definition Files for additional information about entry points.

Whenever the DLL wants to pass a stimulus event to the ESL for Windows program, it must post a message (using PostMessage) to the window handle received in the initialization function. The message must not be sent (using SendMessage), and should not be posted after the termination routine has been executed.

The message posted must be an unsigned short integer whose value is (WM_USER + eventnumber), where eventnumber is the value that ESL for Windows uses for performing event matching and that is returned in the ESL for Windows built-in function eventnumber. Message parameter one (wParam) must be a short integer; this value is returned in the built-in function eventparam and is used for event parameter matching. Message parameter two (lParam) is reserved and must be NULL.

In order to be notified when an event takes place in the ESL program, the EslEvent routine must be exported by name.

 

/********************************************************************

*             Copyright (C) 1982-2016 ESL Syndetic Limited          *

*                     All Rights Reserved.                          *

*                                                                   *

*                           NOTICE                                  *

*                 PROPRIETARY AND CONFIDENTIAL                      *

*                                                                   *

*This computer program is and contains trade secret and confidential*

* and proprietary information of ESL Syndetic Limited. All use,     *

* disclosure, and/or reproduction not specifically authorized in    *

* writing by ESL Syndetic Limited is prohibited. This program may   *

* also be protected under the copyright and trade secrets laws of   *

* countries  other than the U.S.A.                                  *

*                                                                   *

*  ESL is a registered trademark of ESL Syndetic Ltd.               *

********************************************************************/ 

 

#include <windows.h>

#include <esllib.h>

 

/**************************************************************

* Global Variables                                            *

**************************************************************/

 

HWND hStimWnd = (HWND) NULL; HANDLE ghInst;

USHORT count = 1;

 

/**************************************************************

* InitializeStimulus is called just after loading the EASEL   *

* application and must be exported as ordinal 1               *

**************************************************************/

 

USHORT APIENTRY InitializeStimulus (hWnd) HWND hWnd;

{

    hStimWnd = hWnd;

    return(0);

}

 

/**************************************************************

* TerminateStimulus is called immediately before exiting the  *

* EASEL application and must be exported as ordinal 2         *

**************************************************************/

 

USHORT APIENTRY TerminateStimulus (hWnd) HWND   hWnd;

{

    hStimWnd = (HWND) NULL;

    return(0);

}

/**************************************************************

* StimulusStart is called by the EASEL application to start   *

* the stimulus responses posted back to EASEL                 *

**************************************************************/

 

long ESLSUBAPI StimulusStart()

{

 

    PostMessage (hStimWnd, WM_USER + 1,(WPARAM) 1, (LPARAM) 0);

    return(0L);

 

}

 

/**************************************************************

* StimFunc is called by the EASEL application to determine the*

* status of resources or devices and must be exported as      *

* ordinal 3.                                              *

**************************************************************/

void APIENTRY StimFunc(void)

{

}

/**************************************************************

* EslEvent is called by the EASEL immediately before and after*

* the stimulus response is generated in the EASEL application *

* This routine will post two additional stimulus messages back*

* to EASEL before the preceding stimulus response has been   *

* generated.                                              *

**************************************************************/ 

VOID APIENTRY EslEvent(HWND hwnd, USHORT eventnumber, WPARAM eventparameter, SHORT flag) {

 

    if (flag == 2 && count < 3)

    {

        count++;

        PostMessage (hStimWnd, WM_USER + count,(WPARAM) 1,

                     (LPARAM)    0);

    }

}