色偷偷偷久久伊人大杳蕉,色爽交视频免费观看,欧美扒开腿做爽爽爽a片,欧美孕交alscan巨交xxx,日日碰狠狠躁久久躁蜜桃

電子工程網(wǎng)

標(biāo)題: VB.NET下采用索引對(duì)WinIO的封裝類(lèi)(WinIO.vb) [打印本頁(yè)]

作者: hotpower    時(shí)間: 2009-4-3 00:15
標(biāo)題: VB.NET下采用索引對(duì)WinIO的封裝類(lèi)(WinIO.vb)
Imports System.Runtime.InteropServices
Imports System.Text
Imports System.Threading
Imports System.Windows.Forms 'MessageBox需要
'菜農(nóng)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內(nèi)加Private WinIoPort As New WinIO()
    Private blEnable As Boolean
    Private blError As Boolean
    Sub New() '//構(gòu)造函數(shù)(自動(dòng)運(yùn)行)
        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() '析構(gòu)函數(shù)(自動(dòng)運(yùn)行)
        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




歡迎光臨 電子工程網(wǎng) (http://m.54549.cn/) Powered by Discuz! X3.4