VB里另一种更高效的Base64编码与解码算法
Option Explicit
'名称: Base64编码/解码模块
'Name: Base64 Encode & Decode Module
'作者: KiteGirl [中国]
'programmer: KiteGirl [China]
Private priBitMoveTable() As Byte '移位缓冲表
Private priBitMoveTable_CellReady() As Boolean '移位缓冲表标志表
Private priBitMoveTable_Create As Boolean '移位缓冲表创建标志
Private priEncodeTable() As Byte '编码表(素码转Base64)
Private priEncodeTable_Create As Boolean
Private priDecodeTable() As Byte '解码表(Base64转素码)
Private priDecodeTable_Create As Boolean
Private Declare Sub Base64_CopyMemory Lib "kernel32" Alias "RtlMoveMemory" (ByRef pDestination As Any, ByRef pSource As Any, ByVal pLength As Long)
Private Const conBase64_CodeTableStrng As String = "ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/"
Private Const conBase64_PatchCode As Byte = 61
Private Type tpBase64_Dollop2438 '24Bit(8Bit*3Byte)数据块
btBytes(0 To 2) As Byte
End Type
Private Type tpBase64_Dollop2446 '24Bit(6Bit*4Byte)数据块
btBytes(0 To 3) As Byte
End Type
'解码
Public Sub Base64_Decode(ByRef tOutBytes() As Byte, ByRef pBytes() As Byte, Optional ByVal pPatchCode As Byte = conBase64_PatchCode)
'Base64Decode函数
'语法:[tOutBytes()] = Base64Decode(pBytes(), [pPatchCode])
'功能:将Byte数组表示的Base64编码Ascii字节数组解码为Byte字节数组,并返回。
'参数:byte pBytes() '必要参数。Byte数组表示的Base64编码数据。
' byte pPatchCode '可选参数。冗余字节追加码。默认为61("="的Ascii码)
'返回:byte tOutBytes() 'Byte数组。
'示例:
' Dim tSurString As String
' Dim tSurBytes() As Byte
' tSurString = "S2l0ZUdpcmzKx7j2usO6otfT"
' tSurBytes() = StrConv(tSurString, vbfromUnicode)
' Dim tDesString As String
' Dim tDesBytes() As Byte
' tDesBytes() = Base64Decode(tSurBy
相关文档:
VB中 Replace 函数
描述
返回字符串,其中指定数目的某子字符串被替换为另一个子字符串。
语法
Replace(expression, find, replacewith[, compare[, count[, start]]])
Replace 函数的语法有以下参数:
参数 描述
expression 必选。字符串表达式,包含要替换的子字符串。
find 必选。被搜索的子字符串。
......
学生时代专业是机械,但是参加工作后,机缘巧合从事了与软件相关的工作,就是对大型工程软件软件做一些二次开发,收获过快乐,收获过辛酸,在一次又一次的得与失中,想找一个地方,找一些人可以慢慢与之分享,与之交流,并期得到帮助或提供帮助!也许你是无意见路过,甚或漂过,但你的注目是我前进的动力,有幸驻足也会让我 ......
Private Declare Function ExitWindowsEx Lib "user32" (ByVal uFlags As Long, ByVal dwReserved As Long) As Long
Private Const EWX_LOGOFF = 0
Private Const EWX_SHUTDOWN = 1
Private Const EWX_REBOOT = 2
Private Const EWX_FORCE = 4
Private closeTime As String
Sub AdjustTokenPrivilegesForNT()
......
VB显示透明FLASH效果
演示效果:
代码如下:
公共声明区域
Option Explicit
Private Declare Function GetWindowLong Lib "user32" Alias "GetWindowLongA" (ByVal hwnd As Long, ByVal nIndex As Long) As Long
Private Declare Function SetWindowLong Lib "user32" Alias "SetW ......
添加2个text,一个command,一个 WebBrowser
Dim vDoc, vTag
Dim i As Integer
Private Sub Command1_Click()
Set vDoc = WebBrowser1.Document
For i = 0 To vDoc.All.length - 1
If UCase(vDoc.All(i).tagName) = "INPUT" Then
Set vTag = vDoc.All(i)
If vTag.Type = "text" Then
Select Case vTag.Nam ......