-1
我有DLL編碼在VB
,我想打電話給它的COM components
從純C
。以下是dll
的幾行代碼。假設我想從普通的C
調用方法Initialize()
,那麼中方法CoCreateInstance
的參數應該是什麼。從C DLL文件(VB中wirtten)調用COM組件從C
我成功地從C++
調用此dll
的所有方法,但我想從C
調用。你能幫我解決這個問題嗎?
Namespace Thermodynamics
<System.Serializable()> <ComClass(Calculator.ClassId, Calculator.InterfaceId, Calculator.EventsId)>
Public Class Calculator
Public Const ClassId As String = "5F2B671E-FA61-401e-8D14-71FB5B328F9B"
Public Const InterfaceId As String = "0EA44EDE-AD65-435c-B8CC-0D1146BD182B"
Public Const EventsId As String = "0817BD3F-5278-4e49-A7FB-92416A8A7E4E"
Private _availablecomps As Dictionary(Of String, ConstantProperties)
Sub New()
End Sub
''' <summary>
''' Initializes the calculator and loads the compound databases into memory.
''' </summary>
''' <remarks></remarks>
<System.Runtime.InteropServices.DispId(1)> Sub Initialize()
'load databases
_availablecomps = New Dictionary(Of String, ConstantProperties)
'ChemSep
Me.LoadCSDB()
'load DWSIM XML database
Me.LoadDWSIMDB()
End Sub
你是怎麼用C++做的? – GolezTrol
首先,我使用regasm註冊了dll。這個過程生成了一個可直接在C++中使用的.tlb文件。以下是從C++調用它的代碼。 –
#import「C:/ DTLSource/DTLSource/DTL master/DWSIM/bin/Debug/DTL.tlb」raw_interfaces_only –