(SCL2008)VB.Net:创建SCL_API.vb添加dll库函数

版权声明:本文为博主原创文章,未经博主允许不得转载。 https://blog.csdn.net/u011978079/article/details/89475805

创建SCL_API.vb文件,添加以下代码,并将dll文件拷贝到bin或bin/debug文件夹下

Option Strict Off
Option Explicit On

Imports System.Runtime.InteropServices

Module SCL_API
	'******************************************************************************
	' 名称: SCL_API.vb
    ' 简介: 本模块包括所有SCL_API_Stdcall.dll调用的声明

    <StructLayout(LayoutKind.Sequential)> Structure DirItemType
        <VBFixedArray(8)> Dim Name() As Char          ' 用空格扩展填充的文件名
        <VBFixedArray(3)> Dim Ext() As Char           ' 用空格扩展填充的扩展名
        Dim Attr As Byte                              ' 属性,$00表示普通文件, $10表示子目录
        <VBFixedArray(10)> Dim Reserved() As Byte     ' 保留
        Dim CTTime As Short                           ' 文件创建的时间, bit15-11 时, bit10-5 分, bit4-0 秒/10
        Dim CTDate As Short                           ' 文件创建的日期, bit15-9 年-1980, bit8-5 月, bit4-0 日
        Dim Cluster As Short                          ' 文件存储位置的簇号
        Dim Length As Integer                         ' 以字节为单位的文件长度

        Public Sub Initialize()
            ReDim Name(7)
            ReDim Ext(2)
            ReDim Reserved(9)
        End Sub
    End Structure

    '控制卡运行状态信息
    <StructLayout(LayoutKind.Sequential)> Structure RunTimeInfo
        <VBFixedArray(30)> Dim Start() As Byte       '无关数据
        Dim TotalProgCount As Short                  '当前节目表中的节目总数
        Dim CurrentProg As Short                     '正在播放的节目序号
        Dim NotUsed1 As Short                        '无关数据
        Dim DrvProg As Short                         '当前运行的节目表所在的驱动器
        Dim SD_OK As Short                           'SD 卡就绪标记,0:未就绪,1:就绪
        Dim NotUsed2 As Short                        '无关数据
        Dim Humid As Short                           '湿度采样结果
        Dim Temperature As Short                     '温度采样结果,有符号
        Dim PowerSwitch As Short                     '屏体电源开关状态
        Dim NotUsed3 As Integer                      '无关数据
        Dim ProgramIndex As Byte                     '当前播放节目表的索引
        Dim ProgramDrv As Byte                       '当前播放节目表的驱动器
        <VBFixedArray(7)> Dim NotUsed4() As Short    '无关数据
        Dim ColorBytes As Short                      '每点颜色深度,2:16位色,3:24位色
        Dim Second As Short                          '控制卡时钟之秒
        Dim Minute As Short                          '控制卡时钟之分
        Dim Hour As Short                            '控制卡时钟之时
        Dim Day As Short                             '控制卡时钟之日
        Dim Month As Short                           '控制卡时钟之月
        Dim Week As Short                            '控制卡时钟之星期
        Dim Year As Short                            '控制卡时钟之年
        Dim Brightness As Short                      '当前亮度等级
        Dim NotUsed5 As Short                        '无关数据
        <VBFixedArray(64)> Dim Com1Data(,) As Char   '串口1收到的8组数据
        <VBFixedArray(64)> Dim Com2Data(,) As Char   '串口2收到的8组数据
        <VBFixedArray(64)> Dim Com3Data(,) As Char   '串口3收到的8组数据
        <VBFixedArray(24)> Dim NotUsed6() As Integer '无关数据
        Dim TimerOK As Short                         '0:日历时钟芯片读出失败, 1:日历时钟数据有效
        Dim PowerMode As Short                       '0:屏体电源被强行关闭,1:屏体电源被强行打开,2:正在执行自动控制
        <VBFixedArray(8)> Dim ProgPath() As Char
        <VBFixedArray(3)> Dim NotUsed7() As Short
        Dim SW1 As Short                             'SW1的实际状态
        Dim SW2 As Short                             'SW2的实际状态
        <VBFixedArray(57)> Dim NotUsed8() As Short

        Public Sub Initialize()
            ReDim Start(29)
            ReDim NotUsed4(6)
            ReDim Com1Data(7, 7)
            ReDim Com2Data(7, 7)
            ReDim Com3Data(7, 7)
            ReDim NotUsed6(23)
            ReDim ProgPath(7)
            ReDim NotUsed7(2)
            ReDim NotUsed8(56)
        End Sub
    End Structure

    '文本输出信息结构
    <StructLayout(LayoutKind.Sequential)> Structure TextInfoType
        Dim Left_ As Short                           '区域左上角的水平坐标
        Dim Top_ As Short                            '区域左上角的垂直坐标
        Dim Width_ As Short                          '区域的宽度
        Dim Height_ As Short                         '区域的高度
        Dim Color As Integer                         '颜色
        Dim ASCFont As Short                         '西文字体索引
        Dim HZFont As Short                          '汉字字体索引
        Dim XPos As Short                            '输出位置的水平坐标
        Dim YPos As Short                            '输出位置的垂直坐标
    End Structure

    '函数定义
    Declare Function SCL_NetInitial Lib "SCL_API_Stdcall" (ByVal DevID As Short, ByVal Password As String, ByVal IP As String, ByVal TimeOut As Integer, ByVal Retry As Integer, ByVal UDPPort As Short, ByVal SCL2008 As Boolean) As Boolean
    Declare Function SCL_ComInitial Lib "SCL_API_Stdcall" (ByVal DevID As Short, ByVal ComPort As Integer, ByVal Baudrate As Integer, ByVal LedNum As Integer, ByVal TimeOut As Integer, ByVal Retry As Integer, ByVal SCL2008 As Boolean) As Boolean
    Declare Function SCL_Close Lib "SCL_API_Stdcall" (ByVal DevID As Short) As Boolean
    Declare Function SCL_SetRemoteIP Lib "SCL_API_Stdcall" (ByVal DevID As Short, ByVal sIP As String) As Boolean
    Declare Function SCL_SetLEDNum Lib "SCL_API_Stdcall" (ByVal DevID As Short, ByVal LedNum As Integer) As Boolean
    Declare Function SCL_TargetSCL2008 Lib "SCL_API_Stdcall" (ByVal DevID As Short, ByVal b2008 As Boolean) As Boolean
    Declare Function SCL_GetLastResult Lib "SCL_API_Stdcall" (ByVal DevID As Short) As Boolean
    Declare Function SCL_InitForPackage Lib "SCL_API_Stdcall" (ByVal DevID As Short, ByVal bNet As Boolean, ByVal bSCL2008 As Boolean) As Boolean
    Declare Function SCL_GetPackage Lib "SCL_API_Stdcall" (ByVal DevID As Short, ByVal Data As Byte, ByVal AnswerCount As Integer) As Integer
    Declare Function SCL_CheckAnswer Lib "SCL_API_Stdcall" (ByVal DevID As Short, ByRef AnswerCount As Integer, ByRef Answer As Byte) As Boolean
    Declare Function SCL_SendFile Lib "SCL_API_Stdcall" (ByVal DevID As Short, ByVal DrvNo As Integer, ByVal Path As String, ByVal FileName As String) As Boolean
    Declare Function SCL_ReceiveFile Lib "SCL_API_Stdcall" (ByVal DevID As Short, ByVal DrvNo As Integer, ByVal RemoteName As String, ByVal LocalName As String) As Integer
    Declare Function SCL_SendSmallFile Lib "SCL_API_Stdcall" (ByVal DevID As Short, ByVal DrvNo As Integer, ByVal Name As String, ByVal Len As Integer, _
                                       ByVal Time_ As Integer, ByVal Date_ As Integer, ByVal RestartFlag As Short, ByVal RestartDrv As Short, ByVal RestartIndex As Short, ByRef Data As Byte) As Boolean
    Declare Function SCL_RemoveFile Lib "SCL_API_Stdcall" (ByVal DevID As Short, ByVal DrvNo As Integer, ByVal FileName As String) As Boolean
    Declare Function SCL_MD Lib "SCL_API_Stdcall" (ByVal DevID As Short, ByVal DrvNo As Integer, ByVal Path As String) As Boolean
    Declare Function SCL_RD Lib "SCL_API_Stdcall" (ByVal DevID As Short, ByVal DrvNo As Integer, ByVal Path As String) As Boolean
    Declare Function SCL_FreeSpace Lib "SCL_API_Stdcall" (ByVal DevID As Short, ByVal DrvNo As Integer) As Integer
    Declare Function SCL_DirItemCount Lib "SCL_API_Stdcall" (ByVal DevID As Short, ByVal DrvNo As Integer, ByVal Path As String) As Integer
    Declare Function SCL_GetDirItem Lib "SCL_API_Stdcall" (ByVal DevID As Short, ByVal ItemCount As Integer, ByVal Buff As Integer) As Boolean
    Declare Function SCL_SendData Lib "SCL_API_Stdcall" (ByVal DevID As Short, ByVal Offset As Integer, ByVal SendBytes As Integer, ByRef Buff As Byte) As Boolean
    Declare Function SCL_ReceiveData Lib "SCL_API_Stdcall" (ByVal DevID As Short, ByVal Offset As Integer, ByVal ReadBytes As Integer, ByRef Buff As Byte) As Boolean
    Declare Function SCL_SaveFile Lib "SCL_API_Stdcall" (ByVal DevID As Short, ByVal DrvNo As Integer, ByVal FileName As String, ByVal Length As Integer, ByVal Da As Integer, ByVal Ti As Integer) As Boolean
    Declare Function SCL_LoadFile Lib "SCL_API_Stdcall" (ByVal DevID As Short, ByVal DrvNo As Integer, ByVal FileName As String) As Boolean
    Declare Function SCL_ShowString Lib "SCL_API_Stdcall" (ByVal DevID As Short, ByRef TextInfo As Short, ByVal Str_ As String) As Boolean
    Declare Function SCL_Reset Lib "SCL_API_Stdcall" (ByVal DevID As Short) As Boolean
    Declare Function SCL_Replay Lib "SCL_API_Stdcall" (ByVal DevID As Short, ByVal Drv As Integer, ByVal Index As Integer) As Boolean
    Declare Function SCL_SetTimer Lib "SCL_API_Stdcall" (ByVal DevID As Short) As Boolean
    Declare Function SCL_SetBright Lib "SCL_API_Stdcall" (ByVal DevID As Short, ByVal Bright As Short) As Boolean
    Declare Function SCL_SetOnOffTime Lib "SCL_API_Stdcall" (ByVal DevID As Short, ByVal OnTime As Short, ByVal OffTime As Short) As Boolean
    Declare Function SCL_SetTempOffset Lib "SCL_API_Stdcall" (ByVal DevID As Short, ByVal Offset As Short) As Boolean
    Declare Function SCL_FormatDisk Lib "SCL_API_Stdcall" (ByVal DevID As Short, ByVal DevNo As Integer) As Boolean
    Declare Function SCL_SetPowerMode Lib "SCL_API_Stdcall" (ByVal DevID As Short, ByVal PwrMode As Integer) As Boolean
    Declare Function SCL_GetRunTimeInfo Lib "SCL_API_Stdcall" (ByVal DevID As Short, ByRef Buff512Bytes As Byte) As Boolean
    Declare Function SCL_GetPlayInfo Lib "SCL_API_Stdcall" (ByVal DevID As Short, ByRef PlayInfo As Byte) As Boolean
    Declare Function SCL_LedShow Lib "SCL_API_Stdcall" (ByVal DevID As Short, ByVal OnOff As Boolean) As Boolean
    Declare Function SCL_SetExtSW Lib "SCL_API_Stdcall" (ByVal DevID As Short, ByVal OnOff As Short) As Boolean
    Declare Function SCL_GetFileDosDateTime Lib "SCL_API_Stdcall" (ByVal FileName As String, ByRef Da As Integer, ByRef Ti As Integer) As Boolean
    Declare Function SCL_PictToXMPFile Lib "SCL_API_Stdcall" (ByVal ColorType As Integer, ByVal W As Integer, ByVal H As Integer, ByVal bStretched As Boolean, ByVal PictFile As String, ByVal XMPFile As String) As Boolean
    Declare Function SCL_GetMaxFileSize Lib "SCL_API_Stdcall" (ByVal TotalBuff As Integer, ByVal bSmallest As Boolean, ByVal bSCL2008 As Boolean) As Integer
    Declare Function SCL_AddXMPToXMP Lib "SCL_API_Stdcall" (ByVal InFileName As String, ByVal OutFileName As String, ByVal BuffSize As Integer) As Integer
    Declare Function SCL_Init_Start Lib "SCL_API_Stdcall" (ByVal Delay As Short, ByVal RemoteIP As String, ByVal Port As Short, ByVal NetMask As String, ByVal bSCL2008 As Boolean) As Boolean
    Declare Function SCL_Init_Get Lib "SCL_API_Stdcall" (ByRef NetPara As Byte) As Boolean
    Declare Function SCL_Init_Set Lib "SCL_API_Stdcall" (ByRef NetPara As Byte) As Boolean
    Declare Function SCL_Init_Close Lib "SCL_API_Stdcall" () As Boolean
    Declare Function SCL_SeekStart Lib "SCL_API_Stdcall" (ByVal Delay As Short, ByVal RemoteIP As String, ByVal Port As Short, ByVal NetMask As String, ByVal bSCL2008 As Boolean) As Boolean
    Declare Function SCL_SeekGetAItem Lib "SCL_API_Stdcall" (ByVal IP As String, ByVal Name As String) As Boolean
    Declare Function SCL_SeekClose Lib "SCL_API_Stdcall" () As Boolean

End Module

猜你喜欢

转载自blog.csdn.net/u011978079/article/details/89475805