如何在Delphi中编写一个EXE,它也是一个COM服务器
我有一个 Delphi (2007) 应用程序,它只是一个标准的 exe,我想向它添加一个 COM 接口。我已经有一个 COM dll,它导出多个 COM 对象,并且运行良好。然而,当我尝试将 dll 中的 COM 逻辑(即“exports”和“{$R *.TLB}”以及相关用途)插入 EXE 的 dpr 文件时,它全部编译完美,但在我调用 regsvr32 时拒绝注册myname.exe
我还尝试创建一个全新的 VCLForms 应用程序,并通过 IDE 向导向其中添加一个 AutomationObject,但 Delphi 似乎不希望我这样做,因为没有可用的 Activex 组件。
是否有可能做我尝试做的事情?如果是这样,有人知道可能出了什么问题吗?
谢谢
I have a Delphi (2007) application which is just a standard exe, and I would like to add a COM interface to it. I already have a COM dll which exports several COM objects and this is working perfectly. However when I attempted to insert the COM logic from the dll (ie the "exports" and "{$R *.TLB}" and the relevant uses) into the EXE's dpr file it all compiles perfectly but refuses to register when I call regsvr32 myname.exe
I also tried creating an completely new VCLForms application and adding a AutomationObject to it via the IDE wizards but Delphi does not seem to want me to do that as no activex components are available.
Is it even possible to do what I attempting? If so, does anyone have any idea on what might be going wrong?
Thanks
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(2)
我不确定 regsvr32 是否有效,您需要运行 app.exe /regserver 或 app.exe /unregserver。
I'm not sure regsvr32 works, you need to run the app.exe /regserver or app.exe /unregserver.
您的 exe 是否正在导出 DllRegisterServer 和 < a href="http://msdn.microsoft.com/en-us/library/ms691457%28v=VS.85%29.aspx" rel="nofollow">DllUnregisterServer?
Is your exe exporting DllRegisterServer and DllUnregisterServer?