Joe Caverly
28-04-2025, 14:45
This is a method of creating a 32-bit ActiveX COM dll from the command line,
without the need to use Visual Studio.
This 32-bit ActiveX COM dll can then be used from;
Powershell
thinBasic
VBScript
Visual Basic 6.0
Visual FoxPro 9.0
...and other 32-bit applications.
Here's the C# source for SimpleComDLL.cs (https://github.com/JoeC4281/SimpleCOMDll/blob/main/SimpleComClass.cs)
using System;
using System.Runtime.InteropServices;
namespace SimpleComDll
{
[ComVisible(true)]
[Guid("E7A9A5C7-3B6D-4C6A-9B7A-2B5D5F5D5F5D")]
[InterfaceType(ComInterfaceType.InterfaceIsIDispatch)]
public interface ISimpleComClass
{
void ShowMessage(string message);
double PPP(double PPK); // Adding PPP function to the interface
}
[ComVisible(true)]
[Guid("D7A9A5C7-3B6D-4C6A-9B7A-2B5D5F5D5F5D")]
[ClassInterface(ClassInterfaceType.None)]
public class SimpleComClass : ISimpleComClass
{
public void ShowMessage(string message)
{
Console.WriteLine(message);
}
public double PPP(double PPK)
{
return PPK * 0.454; // Implementing PPP function
}
}
}
Review the source code for 32bit.btm (https://github.com/JoeC4281/SimpleCOMDll/blob/main/32bit.btm) for detailed instructions on how to create the 32-bit ActiveX COM dll.
Here's a thinBasic usage example;
Uses "Console"
dim Cs as iDispatch
dim result as String
CS = CreateObject("SimpleComDll.SimpleComClass")
If IsComObject(cs) then
result = cs.PPP(6.59)
printl result
Else
Printl "Could not create SimpleComDll.SimpleComClass object"
end if
cs = Nothing
Joe
without the need to use Visual Studio.
This 32-bit ActiveX COM dll can then be used from;
Powershell
thinBasic
VBScript
Visual Basic 6.0
Visual FoxPro 9.0
...and other 32-bit applications.
Here's the C# source for SimpleComDLL.cs (https://github.com/JoeC4281/SimpleCOMDll/blob/main/SimpleComClass.cs)
using System;
using System.Runtime.InteropServices;
namespace SimpleComDll
{
[ComVisible(true)]
[Guid("E7A9A5C7-3B6D-4C6A-9B7A-2B5D5F5D5F5D")]
[InterfaceType(ComInterfaceType.InterfaceIsIDispatch)]
public interface ISimpleComClass
{
void ShowMessage(string message);
double PPP(double PPK); // Adding PPP function to the interface
}
[ComVisible(true)]
[Guid("D7A9A5C7-3B6D-4C6A-9B7A-2B5D5F5D5F5D")]
[ClassInterface(ClassInterfaceType.None)]
public class SimpleComClass : ISimpleComClass
{
public void ShowMessage(string message)
{
Console.WriteLine(message);
}
public double PPP(double PPK)
{
return PPK * 0.454; // Implementing PPP function
}
}
}
Review the source code for 32bit.btm (https://github.com/JoeC4281/SimpleCOMDll/blob/main/32bit.btm) for detailed instructions on how to create the 32-bit ActiveX COM dll.
Here's a thinBasic usage example;
Uses "Console"
dim Cs as iDispatch
dim result as String
CS = CreateObject("SimpleComDll.SimpleComClass")
If IsComObject(cs) then
result = cs.PPP(6.59)
printl result
Else
Printl "Could not create SimpleComDll.SimpleComClass object"
end if
cs = Nothing
Joe