# Re: 请问如何用VB6.0与C++连结..........

Posted by George on May 14, 1999 at 08:22:21:

In Reply to: 请问如何用VB6.0与C++连结.......... posted by Andy on May 13, 1999 at 16:49:35:

: 请问我想把C++作成.dll，再把它用VB连结，我需要在C++和VB内分别作什么宣告吗?
: 如果需要，请问我要如何叙述呢?谢谢!!

在VB的MODULE里宣告如下:
若要传值回来:
Declare Function INPORT Lib "yourfunction.dll" (ByVal yourvalue As Integer) As Integer

若不要传值回来:
Declare Sub OUTPORT Lib "yoursub.dll" (ByVal yourvalue1 As Integer, ByVal yourvalue2 As Integer) '输出资料

C所产生的DLL档则放在WINDOWS\SYSTEM32或WINDOWS\SYSTEM里就可以了

不过, VC里面除了.CPP之外, 还要一个.DEF档, 否则VB会
找不到进入点

Follow Ups: