0

有人知道如何为 PowerDesigner 开发插件吗?我正在阅读 PowerDesigner 关于如何创建 ActiveX 插件的文档,它说“ActiveX 必须实现一个名为 IPDAddIn 的特定接口才能成为 PowerDesigner 插件。”。但是不知道IPDAddIn接口在哪里,怎么实现呢?这是 在线文档

4

1 回答 1

0

我有这个老例子,它可以提供一些想法,即使它不是最新的。

using PdAddInTypLib;

namespace MineSpace
{
   [ComVisible(true)]
   [Guid("A6FA0D26-77E8-4DD3-B27E-F4050C3D5188")]
   public class Launcher : IPdAddIn {

      // Main() manages the console or GUI interface
      // the PdAddIn interface is managed by an instance of Launcher
      [ComVisible(false)]
      [STAThread]
      public static void Main(String[] args) {
      }

      public Launcher() {
         _app = null;
      }

      // IPdAddIn implementation
      public void Initialize(Object anApplication) {
         try {
            _app = (PdCommon.Application)anApplication;
         }
         catch (Exception e) {
            // process
         }
      }

      public void Uninitialize() {
      }

      public String ProvideMenuItems(String aMenu, Object anObj) {
          return "";
      }

      public int IsCommandSupported(String aMenu, Object anObj, String aCommand) {
         return 0;
      }

      public void DoCommand(String aMenu, Object anObj, String aCommand) {
      }

      private PdCommon.Application _app;
   }
}

与类声明中的相应部分:

[HKEY_CLASSES_ROOT\MyPlugin.Launcher]
@="MyPlugin.Launcher"

[HKEY_CLASSES_ROOT\MyPlugin.Launcher\CLSID]
@="{13749EFC-1ADA-4451-8C47-FF0B545FF172}"

[HKEY_CLASSES_ROOT\CLSID\{13749EFC-1ADA-4451-8C47-FF0B545FF172}]
@="MyPlugin.Launcher"

[HKEY_CLASSES_ROOT\CLSID\{13749EFC-1ADA-4451-8C47-FF0B545FF172}\InprocServer32]
@="C:\windows\System32\mscoree.dll"
"ThreadingModel"="Both"
"Class"="MyPlugin.Launcher"
"Assembly"="MyPlugin, Version=1.0.1402.33688, Culture=neutral, PublicKeyToken=null"
"RuntimeVersion"="v1.0.3705"

[HKEY_CLASSES_ROOT\CLSID\{13749EFC-1ADA-4451-8C47-FF0B545FF172}\ProgId]
@="MyPlugin.Launcher"

[HKEY_CLASSES_ROOT\CLSID\{13749EFC-1ADA-4451-8C47-FF0B545FF172}\Implemented Categories\{62C8FE65-4EBB-45E7-B440-6E39B2CDBF29}]

以及在 PowerDesigner 中声明外接程序的相应代码。如果该File值存在,PowerDesigner 可以在其上调用 DllRegisterServer,如果该组件尚未注册。

[HKEY_LOCAL_MACHINE\SOFTWARE\Sybase\PowerDesigner 10\Addins\MyPlugin Launcher]
"Enable"="No"
"Class"="MyPlugin.Launcher"
"Type"="ActiveX"
"File"="d:\\myplugin\\myplugin.exe"
于 2013-12-16T11:25:46.977 回答