Making plug-ins

As a case study, let's make the plug-in 'PgTest' in the "[User's Documents folder]\src" folder.
Hereafter top folder of the source code is refered to as [TOP FOLDER].


  1. Start [Microsoft Visual C++ 2008 Express Edition].
    Click the menu item [File] >[New] >[Project] to open the dialog [New Project].
    Set the following settings and click the button.[OK].


  2. [Win32 Application Wizard - PgTest] dialog will be displayed.
    Choose [Application Settings].
    Choose [Dll] as [APplication type].
    Click the button [Finish].


  3. Select 'dllmain.cpp' and 'PgTest.cpp' in [Solution Explorer] >[PgTest] >[Source Files].
    Click the right mouse button on these files to show the shortcut menu.
    Click the menu item [Remove].


  4. Click the button [Delete] to permanently delete 'dllmain.cpp' and 'PgTest.cpp'.


  5. Copy the following files from the directory "[TOP FOLDER]\MolipSDK\StdSrc\eng" into the directory "[User's Documents folder]\src\PgTest".


  6. Change the file name.
    DLLNAME.def -> PgTest.def


  7. Click the right mouse button on '[Solution 'PgTest'] >[PgTest] in [Solution Explorer - PgTest] to show the shortcut menu.
    Click the menu item [Add] >[Existing Item].


  8. The dialog [Add Existing Item - PgTest] will be displayed.
    Select the following files and click the button [Add].


  9. Open 'StdAfx.h'.
    Insert the following sentence into the next to the sentence '// TODO: reference additional headers your program requires...'.

    #include "MpgMolipSdk.h"


  10. Open 'MpaModule.cpp'.

    ----- Modify below -----
    // {7A736A4A-1397-48E5-9BA1-4BE393B9E307}
    static const GUID PG_MODULE_CLSID = FMpgGuid(0x7a736a4a, 0x1397, 0x48e5, 0x9b, 0xa1, 0x4b, 0xe3, 0x93, 0xb9, 0xe3, 0x7);
    ----- End of modification -----

    Modify the sentences above by the following procedure.


  11. Start 'DdGuidGen.exe' in the folder '[TOP FOLDER]\MolipSDK\Tools'.
    Click the button [New GUID] to generate new GUID.
    Click the button [Copy] to copy the GUID into the clipboard.
    Click the button [Exit] to exit this program.


  12. Paste the new GUID into 'MpaModule.cpp' and use it as a value of 'PG_MODULE_CLSID'.


  13. Set the module name and customer support information.
    The module name is displayed in the Plug-in Setup Dialog.
    The customer support information is displayed when the plug-in fails in starting. It is appropriate to set the website for the product and the like.


  14. In this case, set the following values.
    Module Name = "MyTest"
    Customer support information = "www.dynamicdraw.com"


  15. Open 'MpaCompo_0.cpp'.

    ----- Modify below -----
    // {A9AF7D19-B197-413F-BF49-D6D293CA0B24}
    static const GUID PG_COMPONENT_CLSID = FMpgGuid(0xa9af7d19, 0xb197, 0x413f, 0xbf, 0x49, 0xd6, 0xd2, 0x93, 0xca, 0xb, 0x24);
    ----- End of modification -----

    Modify the sentences above by the following procedure.


  16. Start 'DdGuidGen.exe' in the folder '[TOP FOLDER]\MolipSDK\Tools'.
    Click the button [New GUID] to generate new GUID.
    Click the button [Copy] to copy the GUID into the clipboard.
    Click the button [Exit] to exit this program.


  17. Paste the new GUID into 'MpaCompo_0.cpp' and use it as a value of 'PG_COMPONENT_CLSID'.


  18. Set the component name, author's name, component version and the comment.
    The component name is displayed as the sub menu's caption of the menu [Plug-in].
    The author's name, component version and the comment are displayed in the 'About' dialog for the plug-in.
    In this case, use the default values.
    Remove the '----- Modify below -----' line.


  19. Set the menu items for the commands provided by this component.
    The menu items are listed in the component sub menu.
    In this case, use the default values:three commands.


  20. Set the hover hints texts. They are displayed as a hint text on the hover hint window when mouse pointer stay on the plug-in menu command items.
    In this case, use the default values.


  21. Set a recommended accesskey for the plug-in menu item. It is assigned to the plug-in menu item as the accesskey.
    If it happens to specify a same letter with other plug-in component's, it is changed to appropriate letter automatically.
    Set accesskeys for the plug-in menu command items. They are assigned to each command item as an accesskey.
    In this case, use the default values.

    Delete the '----- End of modification -----' line.


  22. Open 'MpaCompo_0.h'.
    Confirm that the size of the array 'm_adwCommandId' is equal to the count of the commands which is defined in 'MpaCompo_0.cpp'.
    In this case, use the default values.


  23. Click the right mouse button on '[Solution 'PgTest'] >[PgTest] in [Solution Explorer - PgTest] to show the shortcut menu.
    Click the menu item [Properties].


  24. The dialog [PgTest Property Pages] will be displayed.
    Set the following settings.


  25. Set the following settings.


  26. Set the following settings.

    Click the button [OK].


That's all you have to do to start the building of the plug-in.
Now Let's build and execute.


  1. Set [Solution Configurations] in the toolbar to [Release].


  2. Click the right mouse button on '[Solution 'PgTest'] in [Solution Explorer - PgTest] to show the shortcut menu.
    Click the menu item [Build Solution] to start the building.


  3. Confirm that the building process has been completed successfully.


  4. To let Dynamic Draw recognize the plug-in, some information has to add in the following registory key.
    HKEY_CLASSES_ROOT\CLSID\{6B73A07D-1F3A-4502-A920-57CFA19DE990}\PlugIn5.4
    You can register by the following procedure.


  5. If your account does not have administrator authority, you have to login with administrator authority.
    Start [Command Prompt].
    If you are using Windows Vista or later version, you have to proceed the following.
    Click the right mouse button on '[Windows Start Button] >[All Programs] >[Accessories] >[Command Prompt]' to show the shortcut menu.
    Click the menu item [Run as administrator].


  6. Change the current directory to the directory '[PgTest]\Release' in which 'PgTest.dll' exists.
    And enter the following.
    regsvr32 PgTest.dll


  7. By the proceedings above, the following dialog will be displayed.
    It has been succeeded to let Dynamic Draw recognize the plug-in [PgTest].


  8. Start Dynamic Draw.
    In the property page [Plug-in] of the dialog [Environment setup], check the checkbox [MyTest] and click the button [OK].


  9. Restart Dynamic Draw.
    Confirm that the menu item [Component-0] has been added in the top menu [Plug-in].


  10. It is not recommended to register at registory without using an installer.
    After the confirmation of the plug-in, unregister the plug-in registration by the following procedure.


  11. Start Dynamic Draw.
    In the property page [Plug-in] of the dialog [Environment setup], uncheck the checkbox [MyTest] and click the button [OK].


  12. Unregister the plug-in registration by the following procedure.

    If your account does not have administrator authority, you have to login with administrator authority.
    Start [Command Prompt].
    If you are using Windows Vista or later version, you have to proceed the following.
    Click the right mouse button on '[Windows Start Button] >[All Programs] >[Accessories] >[Command Prompt]' to show the shortcut menu.
    Click the menu item [Run as administrator].


  13. Change the current directory to the directory '[PgTest]\Release' in which 'PgTest.dll' exists.
    And enter the following.
    regsvr32 -u PgTest.dll


  14. By the proceedings above, the following dialog will be displayed.
    It was succeeded to unregister the plug-in registration.