發表文章

目前顯示的是 7月, 2008的文章

TcpClient使非同步連接

Dim MyTcpClient As New TcpClient() Dim MyResult As IAsyncResult = MyTcpClient.BeginConnect(YourTargetIP, YourTargetPort, Nothing, Nothing) MyResult.AsyncWaitHandle.WaitOne(3000, True) '等三秒 If Not MyResult.IsCompleted Then MyTcpClient.Close() ElseIf MyTcpClient.Connected = True Then MyTcpClient.Close() End If

VB發送Email使用Gmail

'建立 SmtpClient 物件 並設定 Gmail的smtp主機及Port Dim MySmtp As New System.Net.Mail.SmtpClient("smtp.gmail.com", 587) '設定你的帳號密碼 MySmtp.Credentials = New System.Net.NetworkCredential("帳號", "密碼") 'Gmial 的 smtp 使用 SSL MySmtp.EnableSsl = True '發送Email MySmtp.Send("發送者< XXX@gmail.com >", "收件者< XXX@gmail.com >", "Gmail發信測試", "TEST")

使用VB讀取自然人評証卡號

Imports System Imports System.Text Imports System.Runtime.InteropServices Class CitizenDigitalCertificateCardNoReader Public Structure SCARD_IO_REQUEST Public dwProtocol As Integer Public cbPciLength As Integer End Structure '引用 PC/SC(Personal Computer/Smart Card) API WinScard.dll _ Public Shared Function SCardEstablishContext(ByVal dwScope As UInteger, ByVal nNotUsed1 As Integer, ByVal nNotUsed2 As Integer, ByRef phContext As Integer) As Integer End Function _ Public Shared Function SCardReleaseContext(ByVal phContext As Integer) As Integer End Function _ Public Shared Function SCardConnect(ByVal hContext As Integer, ByVal cReaderName As String, ByVal dwShareMode As UInteger, ByVal dwPrefProtocol As UInteger, ByRef phCard As Integer, ByRef ActiveProtocol As Integer) As Integer End Function _ Public Sha

使用VB讀取健保卡基本資料

Imports System Imports System.Text Imports System.Runtime.InteropServices Class CitizenDigitalCertificateCardNoReader Public Structure SCARD_IO_REQUEST Public dwProtocol As Integer Public cbPciLength As Integer End Structure '引用 PC/SC(Personal Computer/Smart Card) API WinScard.dll _ Public Shared Function SCardEstablishContext(ByVal dwScope As UInteger, ByVal nNotUsed1 As Integer, ByVal nNotUsed2 As Integer, ByRef phContext As Integer) As Integer End Function _ Public Shared Function SCardReleaseContext(ByVal phContext As Integer) As Integer End Function _ Public Shared Function SCardConnect(ByVal hContext As Integer, ByVal cReaderName As String, ByVal dwShareMode As UInteger, ByVal dwPrefProtocol As UInteger, ByRef phCard As Integer, ByRef ActiveProtocol As Integer) As Integer End Function _ Public Shared Function SCardDisconnect(ByVal hC

使用VB讀取二代金融卡帳號

Imports System Imports System.Text Imports System.Runtime.InteropServices Class CitizenDigitalCertificateCardNoReader Public Structure SCARD_IO_REQUEST Public dwProtocol As Integer Public cbPciLength As Integer End Structure '引用 PC/SC(Personal Computer/Smart Card) API WinScard.dll _ Public Shared Function SCardEstablishContext(ByVal dwScope As UInteger, ByVal nNotUsed1 As Integer, ByVal nNotUsed2 As Integer, ByRef phContext As Integer) As Integer End Function _ Public Shared Function SCardReleaseContext(ByVal phContext As Integer) As Integer End Function _ Public Shared Function SCardConnect(ByVal hContext As Integer, ByVal cReaderName As String, ByVal dwShareMode As UInteger, ByVal dwPrefProtocol As UInteger, ByRef phCard As Integer, ByRef ActiveProtocol As Integer) As Integer End Function _ Public Shared Function SCardDisconnect(ByVal hCard As Integer