com_module_sample
This is an old revision of the document!
Create a COM module for a VO application
- Create a prg file for the interface
begin namespace COMTest using System.Runtime.InteropServices [ComVisible(true)]; [Guid("750E557E-9DA6-4508-A36E-C4141D27B5D4")]; [InterfaceType(ComInterfaceType.InterfaceIsIDispatch)]; interface ICOMTester [DispId(1)]; method Output() as string end interface end namespace
The GUID needs to be created with the GuidGen.exe tool.
- Create a prg file for the functionality itself:
using System.Runtime.InteropServices begin namespace COMTest [ComVisible(true)]; [Guid("7D1DF22E-3A3D-431C-8BEE-A2F40C53A249")]; [ClassInterface(ClassInterfaceType.None)]; [ProgId("COMTest.COMTester")]; class COMTester implements ICOMTester public constructor() return public virtual method Output() as string return "Hi from my component" end class end namespace
- Build the application (i.e. the DLL)
- create a snk file: sn - k COMTest.snk
- add this snk file as signature to your DLL (Application Properties - Advanced - Assembly signing in XIDE)
- build your application
- read the public key from the application: sn -T COMTest.dll (upper case “T”) and write it somewhere
- create the TLB with administrative rights: regasm COMTest.dll /tlb
- remove the registration again from the registry (with elevated rights): regasm COMTest.dll /unregister
- create the automation server in VO using the created TLB
com_module_sample.1516624954.txt.gz · Last modified: 2018/01/22 12:42 by wolfgangriedmann