国产毛片a精品毛-国产毛片黄片-国产毛片久久国产-国产毛片久久精品-青娱乐极品在线-青娱乐精品

電子工程網

標題: VB.NET下采用索引對WinIO的封裝類(WinIO.vb) [打印本頁]

作者: hotpower    時間: 2009-4-3 00:15
標題: VB.NET下采用索引對WinIO的封裝類(WinIO.vb)
Imports System.Runtime.InteropServices
Imports System.Text
Imports System.Threading
Imports System.Windows.Forms 'MessageBox需要
'菜農HotPower@126.com 2008.11.13 于雁塔菜地
Public Class WinIO
#Region "WinIO API"
    Private Shared Function InitializeWinIo() As Boolean
    End Function
    Private Shared Function ShutdownWinIo() As Boolean
    End Function
    Private Shared Function GetPortVal( _
        ByVal PortAddr As UInt16, ByRef PortVal As UInt32, ByVal bSize As Byte) As Boolean
    End Function
    Private Shared Function SetPortVal( _
        ByVal PortAddr As UInt16, ByVal PortVal As UInt32, ByVal bSize As Byte) As Boolean
    End Function
#End Region
    '在Form1.cs內加Private WinIoPort As New WinIO()
    Private blEnable As Boolean
    Private blError As Boolean
    Sub New() '//構造函數(shù)(自動運行)
        blEnable = False
        blError = False
        Try
            blEnable = InitializeWinIo() '加載WinIO
        Catch ex As System.Exception
            MessageBox.Show(ex.Message, "系統(tǒng)提示", MessageBoxButtons.OK, MessageBoxIcon.Error)
        End Try
    End Sub
    Protected Overrides Sub Finalize() '析構函數(shù)(自動運行)
        If blEnable = True Then
            ShutdownWinIo() '卸載WinIO
        End If
    End Sub
    Public ReadOnly Property Err() As Boolean
        Get
            Return blError
        End Get
    End Property
    Public ReadOnly Property Enable() As Boolean
        Get
            Return blEnable
        End Get
    End Property
    Default Public Property My(ByVal Index As UInt16) As Byte
        'x = WinIoPort(&H378)
        Get
            Dim val As UInt32
            blError = GetPortVal(Index, val, 1)
            Return (val And &HFF)
        End Get
        'WinIoPort(&H378) = &H55
        Set(ByVal value As Byte)
            blError = SetPortVal(Index, value, 1)
        End Set
    End Property
    Default Public Property My(ByVal Index As UInt16, ByVal size As Byte) As UInt32
        'x = WinIoPort(&H378, 1) x = WinIoPort(&H378, 2) x = WinIoPort(&H378, 4)
        Get
            Dim val As UInt32
            blError = GetPortVal(Index, val, size)
            Return val
        End Get
        'WinIoPort(&H378, 1) = &H55 WinIoPort(&H378, 2) = &H5555
        'WinIoPort(&H378, 4) = &H12345678
        Set(ByVal value As UInt32)
            blError = SetPortVal(Index, value, size)
        End Set
    End Property
End Class




歡迎光臨 電子工程網 (http://m.qingdxww.cn/) Powered by Discuz! X3.4
主站蜘蛛池模板: 国产成人亚洲精品91专区手机 | 欧美曰逼视频 | 大伊香蕉精品一区视频在线 | 欧美成人黄色 | 欧美激情免费观看一区 | 九九精品视频免费 | 免费看美女部位隐私 | 国产片自拍 | 亚洲最大免费视频网 | 国产精品所毛片视频 | 99热免费在线观看 | 久草久草视频 | 国产三级精品三级在线专区1 | 午夜在线网站 | 在线播放国产精品 | 九九热在线精品 | 厚颜无耻韩国动漫免费观看5 | 久久久久999| 岛国大片在线播放免费 | 在线欧美成人 | 欧美精品在线视频 | 日日狠狠久久偷偷四色综合免费 | 日韩欧美色视频在线观看 | 欧美高清日韩 | 一区二区精品在线 | www.91免费视频 | 久久久久国产一级毛片高清板 | 人成在线免费视频 | 国内外成人免费在线视频 | 免费看黄片毛片 | 亚洲色四在线视频观看 | 亚洲成人网在线播放 | 一及毛片 | 午夜黄色小视频 | 四虎欧美在线观看免费 | 成人免费视频在 | 亚洲午夜视频在线 | 成人高清在线观看 | 亚洲性大片 | 国产女人好紧好爽 | 久久精品国产免费 |