到此我们就可以在Visual Basic中通过动态链接库技术间接操作I/O端口了。在Visual
Basic中动态链接库必须提前申明,其缺省为公有过程或函数。其格式为:“Declare Sub 过程名 Lib ‘库名’ [Alias ‘别名’]
[(参数表)]”,或者“Declare Function 过程名 Lib ‘库名’ [Alias ‘别名’] [(参数表)] As
类型”。例如:
Public Declare Function Outport Lib "vcDll.dll" (ByVal portid As
Integer, ByVal value As Integer) As Integer //IO输出函数 Public Declare
Function Inport Lib "vcDll.dll" (ByVal portid As Integer) As Integer
//IO输入函数