Warning: file_get_contents(/data/phpspider/zhask/data//catemap/8/linq/3.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
对DLL的特定VBA调用_Dll - Fatal编程技术网

对DLL的特定VBA调用

对DLL的特定VBA调用,dll,Dll,我正在使用一个名为Coolprops的程序将制冷剂属性输入电子表格。它包括一个由代码编译的DLL。幸运的是,它附带了一个模块,其中已经设置了对DLL的调用。我在让程序按原样开箱即用方面没有问题 我需要做的是访问位于代码第1042行的函数。我尝试复制和修改一个从盒子中发出的呼叫: Private Declare Function Props_private Lib "K:\Refrigeration\Coolprop\CoolProp.dll" Alias "_Props@32" (ByVal O

我正在使用一个名为Coolprops的程序将制冷剂属性输入电子表格。它包括一个由代码编译的DLL。幸运的是,它附带了一个模块,其中已经设置了对DLL的调用。我在让程序按原样开箱即用方面没有问题

我需要做的是访问位于代码第1042行的函数。我尝试复制和修改一个从盒子中发出的呼叫:

Private Declare Function Props_private Lib "K:\Refrigeration\Coolprop\CoolProp.dll" Alias "_Props@32" (ByVal Output As String, ByVal Name1 As Long, ByVal Value1 As Double, ByVal Name2 As Long, ByVal Value2 As Double, ByVal Ref As String) As Double
为此:

Private Declare Function set_ref_state Lib "K:\Refrigeration\Coolprop\CoolProp.dll" Alias "set_reference_stateP" (ByVal fluid As String, ByVal ref_state As string)
但当我在代码中调用它时:

Public Function Props(ByVal Output As String, ByVal Name1 As String, ByVal Value1 As Double,     ByVal Name2 As String, ByVal Value2 As Double, ByVal fluid As String) As Double

Dim refstate

refstate = set_ref_state("Ammonia", "ASHRAE")

Dim errstring As String
Dim N1, N2 As Integer
Dim Props_temp As Double
Dim L As Long


Props_temp = Props_private(Output, Asc(Left(Name1, 1)), Value1, Asc(Left(Name2, 1)), Value2, fluid)
If Abs(Props_temp > 100000000) Then
    'Make a null-terminated string that is plenty big
    errstring = String(2000, vbNullChar)
    'Get the error string
    L = get_global_param_string_private("errstring", errstring)
    'Display it
    Props = errstring
Else
    Props = Props_temp
End If

End Function
功能道具坏了


我猜我错过了一些简单的东西

不确定您是否仍然无法解决此问题,但您需要更改别名。在上查看DLL的导出。它应该是
\u set\u参考_stateS@8

啊,窗户的欢乐

在将来,堆栈溢出可能不是您获得帮助的最佳选择-请查看coolprop.org上的所有帮助链接