MKI_PlugInInit (Callback) Renamed in Version 2015.0

www.CAD6.com

C++ Syntax

__int32

MKI_PlugInInit(

 const LPCSTR f_pszSerialNumber,

 HINSTANCE f_hMainInst,

 HWND f_hMainWnd,

 __int32 f_nInterfaceVersion,

 MKI_PLUGIN_ID_REF f_rPlugInID )

 

typedef __int32

(*MKI_PLUGININIT_PROC)(

 const LPCSTR f_pszSerialNumber,

 HINSTANCE f_hMainInst,

 HWND f_hMainWnd,

 __int32 f_nInterfaceVersion,

 MKI_PLUGIN_ID_REF f_rPlugInID );

 

This procedure is called when the plug-in is loaded into the application's memory, i.e. when the application starts. The procedure is called each time an instance of the application is started. But as every single instance of the DLL lies in another memory segment, each instance can act like being the only instance in memory.

 

Parameters

f_pszSerialNumber

[const LPCSTR] This string contains the serial number of the serving application. It can be used to determine whether this plug-in is licensed to run on that application. If the serving application is a demo version, the string f_pszSerialNumber will only contain the word "DEMO" in capitals. In this case, export filters should either not work at all or at least add some additional data to the exported drawing (like the word "DEMO" across the drawing).

f_hMainInst

[HINSTANCE] Instance handle of the serving application. This handle can be used to retrieve data from the serving application, like bitmaps, cursors etc.

f_hMainWnd

[HWND] Window handle of the serving application's main window. This handle should be used as the parent window's handle when displaying dialog windows.

f_nInterfaceVersion

[__int32] This value indicates the current interface version of the serving application. Compare this value with the constant MKI_INTERFACE_VERSION. If f_nInterfaceVersion is less than MKI_INTERFACE_VERSION return 0.

f_nPlugInID

[MKI_PLUGIN_ID_REF] Address of a plug-in identification structure that must be filled in by the plug-in before returning true from MKI_PlugInInit.

 

Return Value Changed in Version 6.40

Should return one of the following values:

 

MKI_INIT_OK

The plug-in was successfully initialized and can be used.

 

MKI_INIT_INACTIVE

The plug-in is currently not active, e.g. since the user explicitly deactivated it, or its trial period is expired.

 

MKI_INIT_OLD_PLUGIN

The plug-in is too old to work with this version of the serving application, the application will display an appropriate message.

 

MKI_INIT_OLD_APPLICATION

The serving application is too old to work with this version of the plug-in, the application will display an appropriate message.

 

MKI_INIT_BAD_INSTALL

The plug-in was not correctly installed, e.g. a required resource or file is missing, the application will display an appropriate message.

 

MKI_INIT_ERROR

Any other error during the initialization of the plug-in. In this case, and only in this case, the plug-in should display a message with a comprehensive description of the problem (e.g. out of memory) before returning.

 

If this procedure returns a value different from MKI_INIT_OK, the plug-in will immediately be removed from memory and will not be available to the user. MKI_PlugInExit will only be called if the return value was MKI_INIT_OK.

 

Comment

The time this procedure is called is a good time to perform any initialization like memory allocation, variable initialization etc. Please do not display dialogs or windows showing copyright etc. at this time - this will lead to extreme start-up times of the application. Instead, add either an "Infos..." button to the primary plug-in dialog window or add a menu item "About..." to the plug-in's submenu.

 

The name of the procedure has to be exactly MKI_PlugInInit. For an example of MKI_PlugInInit, see the Basic Plug-In Code.

 

Note: If you have to display dialogs or messages during the handling of this call, please make sure to make any dialog or message box "topmost" (e.g. by stating MB_TOPMOST with the MessageBox call).

 

CAD6interface 2024.2 - Copyright 2024 Malz++Kassner® GmbH