com_module_sample
Differences
This shows you the differences between two versions of the page.
Both sides previous revisionPrevious revisionNext revision | Previous revisionLast revisionBoth sides next revision | ||
com_module_sample [2018/01/23 11:06] – wolfgangriedmann | com_module_sample [2018/09/04 03:52] – wolfgangriedmann | ||
---|---|---|---|
Line 1: | Line 1: | ||
- | ====== Create a COM module for a VO application ====== | + | ====== Create a COM module for a VO application |
* Create a prg file for the interface\\ | * Create a prg file for the interface\\ | ||
- | < | + | < |
using System.Runtime.InteropServices | using System.Runtime.InteropServices | ||
Line 20: | Line 20: | ||
The GUID needs to be created with the GuidGen.exe tool.\\ | The GUID needs to be created with the GuidGen.exe tool.\\ | ||
* Create a prg file for the functionality itself:\\ | * Create a prg file for the functionality itself:\\ | ||
- | < | + | < |
begin namespace COMTest | begin namespace COMTest | ||
Line 50: | Line 50: | ||
* edit the Init() method of the created VO class adding the cProgId and the cClsId using the GUIDs from your library. The cClsId uses the GUID from your class, the cIID the one from your interface. | * edit the Init() method of the created VO class adding the cProgId and the cClsId using the GUIDs from your library. The cClsId uses the GUID from your class, the cIID the one from your interface. | ||
- | < | + | < |
self: | self: | ||
Line 68: | Line 68: | ||
* build your DLL and check with a manifest viewer if your binary contains that manifest | * build your DLL and check with a manifest viewer if your binary contains that manifest | ||
* hopefully your VO application has a manifest. Add a reference to your COM dll: | * hopefully your VO application has a manifest. Add a reference to your COM dll: | ||
- | < | + | < |
< | < | ||
< | < | ||
Line 95: | Line 95: | ||
* to display the manifest in an application you can use this manifest viewer: [[https:// | * to display the manifest in an application you can use this manifest viewer: [[https:// | ||
* Using the DispId attribute in the interface for every method makes sure that every version of your COM dll has the same DispId in the COM interface and you don't need to recreate the TLB file and the automation server in VO after every change. In fact, most of the time you should be able to adjust the automation server in VO manually if you change the interface of the COM library | * Using the DispId attribute in the interface for every method makes sure that every version of your COM dll has the same DispId in the COM interface and you don't need to recreate the TLB file and the automation server in VO after every change. In fact, most of the time you should be able to adjust the automation server in VO manually if you change the interface of the COM library | ||
+ | * in many cases, the definition of the RT_MANIFEST constant in VO inhibits the correct loading of the COM assembly. In these cases, simply add the definition of the constant in your own program. Please see here: [[rt_manifest_constant|RT_MANIFEST constant]] | ||
com_module_sample.txt · Last modified: 2022/10/11 12:02 by wolfgangriedmann