Individual Adjustments of User Plug-ins

<< Click to Display Table of Contents >>

Navigation:  Plug-ins > User Plug-ins > Create a User Plug-in >

Individual Adjustments of User Plug-ins

 

For adjusting the newly created plug-ins, different files are available. A few are detailed below:

File

Description

MyPluginDll.def

Lists all export functions

MyPluginDll.h und MyPluginDll.cpp

Implements plug-in functionality

MyPluginDlg.h und MyPluginDlg.cpp

Implements plug-in window (dialog)

 

 

Explanation of file contents

MyPluginDll.def:

In the module definition file, all required and optional export functions must be listed. Details about required and optional export functions can be found in the chapter export functions.

 

MyPluginDll.h and MyPluginDll.cpp:

In this file, the class CMyPluginApp is defined. It encapsulates the application class of the plug-in, of which there is only one single instance. Implementation of the desired plug-in functionality is provided. It creates an object of the dialog class CMyPluginDlg and displays it. The window can be accessed and displayed using this instance.

Moreover, the export functions must be implemented in MyPluginDll.cpp (independent of the class CMyPluginApp).

MyPluginDlg.h and MyPluginDlg.cpp:

In these files, the dialog class CMyPluginDlg is defined. They represent the dialog window and contain all control elements as well as the associated functionality included in this window.

 

Export functions

The following tables describe all available export functions. Required export functions are indispensable for user plug-ins. Otherwise, the plug-in cannot be loaded by CanEasy. Optional export functions can be omitted if the plug-in-developer does not use them.

Required export functions

Item

Description

DLL_dwGetAPIVersion

Enables CanDll to check compatibility. The content of this function must not be changed. The function is called once before DLL_vInit is called.

DLL_vInit

DLL_vInit is called after loading the plug-in. Here, initialization of the plug-in can be implemented.

DLL_vDeInit

DLL_vDeInit is called before unloading the plug-in. Here de-initializations can be implemented, e.g. release of allocated storage.

DLL_vStart

DLL_vStart is called each time simulation is started. This function can be used, for example, to reset values to their initial status.

DLL_vStop

This function is called when simulation is stopped. Here, for examples, update timers can be stopped.

 

 

Optional export functions

Item

Description

DLL_iPreTranslateMessage

This function filters messages before they are sent to TranslateMessage and DispatchMessage, for example to process Tooltips.

DLL_vOnIdle

DLL_vOnIdle is used for the execution of actions during idle time (i.e. if no window messages are processed).

DLL_iOnEvent

DLL_iOnEvent is used for responses to events. An event is, for example, a click on the entry of the plug-in inside the tree. Also, handling an individual context menu can be controlled here.

DLL_iOnSave

This function can be used to save the settings in the workspace. The function is called if the user initiates “Save” or “Save as…” in CanEasy.

DLL_iOnLoad

This function is called if the user loads a workspace. (e.g. when starting CanEasy or manually loading a workspace).

 

Attention: The version number passed to the function as parameter must be evaluated in any case. Only that way can a user plug-in ensure compatibility to other workspaces.

Please note that the same data quantity is read as previously saved!

 
 

CAND interface

Plug-in developers can use several functions (the “CAND interface”) for the communication between plug-ins and CanEasy. The header file CandUserApi.h must be integrated in the plug-in-project to access the functions. The interfaces are written in ANSI-C and can be used with many software products.