1

I currently am using a .NET type library with vb 6 via a reference to it via Project -> References. I would like to make it more independent. I am curious whether I can access this library via a statement like this:

Public Declare Function Encode Lib "typelibrary.tlb" (ByVal intfilename As String,_
ByVal outfilename As String) As Integer 

I haven't been able to find any reference to this and I haven't been able to get it to work myself. When I try it says: Error:53, File not found: typelibrary.tlb.

4

1 回答 1

0

不,您不能使用Declare Function. 使用 COM 对象时,您可以在添加对类型库/DLL 的引用的地方使用早期绑定,或者在不使用的地方使用后期绑定CreateObject("AssemblyName.ClassName"),但会丢失智能感知等。

或者,您可以[DllExport]在 .Net 中使用,然后您可以使用 VB6 进行调用Declare Function,但是您需要手动转换您需要进行的每个调用。

于 2012-08-15T12:07:02.977 回答