SDK:Menu Command Plug-in Main Function
From Vectorworks Developer
.SDK|SDK ..SDK:Types|SDK Types ..SDK:Using the SDK|Using the SDK ..VCOM:VCOM (Vectorworks Component Object Model)|VCOM Basics ..VCOM:Class Reference|VCOM Class Reference
Menu Command Main Function
The prototype for a Menu Command’s main function is:
extern "C" long plugin_main(
long action,
long message,
long& userData,
CallBackPtr cbp);
The parameters to the main function are:
action long (or also called Event) Identifies the task the menu command needs to perform, and determines the significance of the message parameter. The actions or events are described in detail below. message long This parameter’s meaning depends on the value of the action parameter and the type of menu command. For some actions, it is unused. userData long& Four bytes of data that VectorWorks maintains for the plug-in between calls. This is necessary because a plug-in cannot directly maintain its state between calls. See SDK:Global Data for more info. cbp CallBackPtr An implementation detail. See Communication Between VectorWorks and Plug-ins for more information.
For chunks, the message parameter will often be a pointer to the following structure as defined in MiniCadHookIntf.h:
struct MenuChunkInfo { short menuID; short itemID; short modifiers; union { short chunkIndex; // for kMenuDoInterface short chunkSize; // for kMenuCheckHilite short commandID; // for kMenuAddItems }; };
The meaning of these fields varies slightly for different actions and is explained in SDK:Menu Command Plug-in Events.
See Also
Overview | SDK:Menu Command Plug-in Resources | SDK:Menu Command Plug-in Main Function | SDK:Menu Command Plug-in Events