# How to make the plug-in for Dynamic Draw 4.0

I describe the process of making a plug-in "PgTest" at the directory "C:\SRC" using Microsoft Visual C++ .NET 2003.

Click the following menu.
[File] >> [New] >> [Project]
The [New Project] dialog will be displayed.
Select [Win32] in the Project Types and [Win32 Project] in the Templates.
Enter 'PgTest' in the Name and 'C:\SRC' in the Location.
Push the [OK] button.

[Win32 Application Wizard - PgTest' will be displayed.
Select the [Application Settings].
Select [DLL] in the Application type.
Push the [Finish] button.

Select 'PgTest.cpp' in the [Solution Explorer - PgTest] and remove it.

Delete 'C:\SRC\PgTest.cpp'.

Copy the following files from 'MolipSDK\StdSrc\jp' to 'C:\SRC\PgTest'.
-----------------------
DLLNAME.def
MpaCompo_0.h
MpaCompo_0.cpp
MpaModule.h
MpaModule.cpp
-----------------------

Change the file name. See following.
-------------------------
DLLNAME.def -> PgTest.def
-------------------------

Click the following menu.
[File] >> [Add Existing Item]
The [Add Existing Item] dialog will be displayed.
Select the following files and push the [Open] button.
----------------
MpaCompo_0.h
MpaCompo_0.cpp
MpaModule.h
MpaModule.cpp
----------------

Click the following menu.
[File] >> [Add New Item]
The [Add New Item] dialog will be displayed.
Select 'Visual C++' in the Categories and 'Module-Definition file (.def)' in the Templates.
Enter 'PgTest.def' in the Name and 'C:\SRC\PgTest\' in the Location.
Push the [Open] button.

'PgTest.def' will be diplayed in the [Solution Explorer - PgTest].

Open the 'StdAfx.h'.
Enter '#include "MpgMolipSdk.h"' in the next line of the following.
'// TODO: reference additional headers your program requires here'

Open the 'MpaModule.cpp'.
Modify the following.
----- 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 -----

Click the followin menu.
[Tools] >> [Create GUID]
The [Create GUID] tool will be displayed.
Select [1.] in the GUID Format.
Push the [Copy] button.
Push the [Exit] button.

Paste the GUID on the 'MpaModule.cpp' and use it as the value of PG_MODULE_CLSID.

Set the value of PG_MODULE_NAME.
The value is used to display in the [Environment setup].
-------------------------------------------------
static const wchar_t* PG_MODULE_NAME = L"Test";
-------------------------------------------------
Set the value of PG_MODULE_SUPPORT_INFO.
The value is displayed when the version of the plug-in is not match the version of Dynamic Draw.
--------------------------------------------------
static const wchar_t* PG_MODULE_SUPPORT_INFO = L"www.dynamicdraw.com/index.html";
--------------------------------------------------

Open the 'MpaCompo_0.cpp'.
Modify the following.
----- 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 -----

Click the followin menu.
[Tools] >> [Create GUID]
The [Create GUID] tool will be displayed.
GUID is displayed in the Result.
The GUID must be different from the value of PG_MODULE_CLSID in the 'MpaModule.cpp'.
Select [1.] in the GUID Format.
Push the [Copy] button.
Push the [Exit] button.

Paste the GUID on the 'MpaCompo_0.cpp' and use it as the value of PG_COMPONENT_CLSID.

The value of 's_wcpComponentName' is displayed as the title of the submenu in the Dynamic Draw.
The values of 's_wcpAuthorName', 's_wcpComponentVersion' and s_wcpComponentComment' are used in the [About plug-in] dialog.
Change them to the appropriate values.

The 's_tcpMenu' is an array of the commands that are displayed in the [plug-in] menu.
In the following example, there are three commands.

The 's_wcpHintText' is an array of the pophint contents that are displayed when the mouse pointer is rest on the command.

The value of the 's_wcComponentShortcut' is used as an access-key in the [plug-in] menu.
If the value is same as the value of another plug-in, some different letter will be used.

The 's_tcpMenuShortcut' is an array of the access-keys that are used in the submenu of the [plug-in] menu.

Open the 'MpaCompo_0.h.
The size of the array 'm_adwCommandId' must be same as the amount of the commands in the 'MpaCompo_0.cpp'.

Select 'PgTest' in the [Solution Explorer - PgTest].
Click the following menu.
[Project] >> [Properties]

The [PgTest Property Pages] dialog will be displayed.
Select 'All Configurations' in the [Configuration].
Click 'General' in the 'C/C++' and enter the file path of the 'MolipSDK' in the [Additional Include Directories].
Push the [OK] button.

Click the following menu.
[Build] >> [Build Solution]

You have to register the information about the plug-in in the following registry.
-------------------------------------------------------
HKEY_CLASSES_ROOT\CLSID\{6B73A07D-1F3A-4502-A920-57CFA19DE990}\PlugIn4.1
-------------------------------------------------------
Start the Command Prompt.
Move to the directory 'C:\SRC\PgTest\Debug'.
Enter the following.
regsvr32 PgTest.dll

If the registration task is successfully finished, the following dialog will be displayed.

Start 'MolipSDK\Debug\eng\DynamicDraw.exe'.

Click the following menu in the Dynamic Draw.
[Options] >> [Environment setup]
'Test' will be displayed in the [plug-in] page.
Tick off it and push the [OK] button.

Exit the Dynamic Draw and restart it.
The menu 'Test' will be appended in the menu [plug-in].