VB加载dll 问题?

来源:百度知道 编辑:UC知道 时间:2024/05/13 15:38:41
VB6.0怎么加载dll文件我是初学者请指教,我要编写并口的程序,但是并口编写需要外加dll文件,请问怎么加载!

以下是加载外部 dll 的一个例子,其中 winspool.drv 换成你dll的路径,如果把你的 dll 放在系统目录中,就不用写路径,直接写你 dll 的文件名就可以了:
Public Declare Function AddMonitor Lib "winspool.drv" Alias "AddMonitorA" (ByVal pName As String, ByVal Level As Long, pMonitors As Byte) As Long

当然,如果 dll 是用 VB 写的,那么就不是这样引用了,VB 写的 DLL 引用如下:工程菜单->引用菜单,找到你的 DLL 实例打上勾点确定就好了。

学习备用