I used the following C# code to generate a COM component, and then created a COM object in QM,
but I was unable to use the dot notation to display the object's member methods.
demo: https://i.ibb.co/nsXN810z/mycom.gif
What did I do wrong?
Thank you in advance for any suggestions and help.
Function Com_Demo_T
Function Com_Demo
My idea is to create the class object in the qm main function, and then use the class object's member functions directly in other functions, so that the COM component is only called once. Is this possible?
but I was unable to use the dot notation to display the object's member methods.
demo: https://i.ibb.co/nsXN810z/mycom.gif
What did I do wrong?
Thank you in advance for any suggestions and help.
Function Com_Demo_T
out
__ComActivator ca.Activate("MyCom.X.manifest")
IDispatch mc._create("ComDemo.MyComClass")
Function Com_Demo
CsScript x.Compile("" "$qm$\MyCom.dll")
out "MyCom.dll is OK!"
1
__ComActivator_CreateManifest "MyCom.dll" 1
out "MyCom.X.manifest is OK!"
#ret
using System;
using System.Runtime.InteropServices;
namespace ComDemo
{
,// Define interface
,[ComVisible(true)]
,[InterfaceType(ComInterfaceType.InterfaceIsDual)]
,[Guid("12345678-1234-4321-ABCD-1234567890AB")]
,public interface IMyComClass
,{
,,int Add(int a, int b);
,,string Hello(string name);
,}
,// Implement COM class
,[ComVisible(true)]
,[ClassInterface(ClassInterfaceType.None)]
,[Guid("ABCD1234-5678-4321-ABCD-1234567890AB")]
,public class MyComClass : IMyComClass
,{
,,public int Add(int a, int b)
,,{
,,,return a + b;
,,}
,,public string Hello(string name)
,,{
,,,return $"Hello, {name}!";
,,}
,}
}
My idea is to create the class object in the qm main function, and then use the class object's member functions directly in other functions, so that the COM component is only called once. Is this possible?