📄 frmbuilddata.frm
字号:
VERSION 5.00
Begin VB.Form frmBuildDATA
Caption = "Build DATA"
ClientHeight = 2835
ClientLeft = 60
ClientTop = 345
ClientWidth = 4680
LinkTopic = "Form2"
ScaleHeight = 2835
ScaleWidth = 4680
StartUpPosition = 3 '窗口缺省
Begin VB.CommandButton Command2
Caption = "Build GB"
Height = 495
Left = 2520
TabIndex = 1
Top = 1740
Width = 1215
End
Begin VB.CommandButton Command1
Caption = "Build BIG5"
Height = 495
Left = 780
TabIndex = 0
Top = 1740
Width = 1215
End
Begin VB.Label Label1
Caption = "单击下面的按钮分别生成BIG5.DAT和GB.DAT"
Height = 555
Left = 540
TabIndex = 2
Top = 540
Width = 3735
End
End
Attribute VB_Name = "frmBuildDATA"
Attribute VB_GlobalNameSpace = False
Attribute VB_Creatable = False
Attribute VB_PredeclaredId = True
Attribute VB_Exposed = False
'*****************************************************
'//
'// BuildDATA.vbp 1999/08/19
'//
'// 作者:陈国强 alone@telekbird.com.cn
'// 原子数据工作室 http://www.quanqiu.com/vb
'//
'// 您可以自由的拷贝并使用本程序
'// 您有义务把程序中的BUG告诉我
'//
'*****************************************************
'
'BIG5.TXT和GB.TXT中分别存放内码信息
'生成BIG5.DAT和GB.DAT后,再到集成开发环境中使用资源编辑
'器(Resource Editor)新建一个资源文件(INS.RES),包含两个
'自定义资源分别为BIG5.DAT和GB.DAT 中的数据,该资源文件将被
'包含basBIG2GB.bas的工程引用
Option Explicit
Private Declare Function CreateFile Lib "kernel32" Alias "CreateFileA" (ByVal lpFileName As String, ByVal dwDesiredAccess As Long, ByVal dwShareMode As Long, ByVal lpSecurityAttributes As Any, ByVal dwCreationDisposition As Long, ByVal dwFlagsAndAttributes As Long, ByVal hTemplateFile As Long) As Long
Private Declare Function WriteFile Lib "kernel32" (ByVal hFile As Long, lpBuffer As Any, ByVal nNumberOfBytesToWrite As Long, lpNumberOfBytesWritten As Long, ByVal lpOverlapped As Any) As Long
Private Declare Function CloseHandle Lib "kernel32" (ByVal hObject As Long) As Long
Private Const GENERIC_READ = &H80000000
Private Const GENERIC_WRITE = &H40000000
Private Const FILE_ATTRIBUTE_NORMAL = &H80
Private Const OPEN_EXISTING = 3
Private Const CREATE_NEW = 1
Private BIG5Order(14757) As Integer
Private GBOrder(8177) As Integer
Private Sub Command1_Click()
Dim fs As FileSystemObject
Dim txt As TextStream
Dim fileDat As String
Dim strTemp As String
Dim strHex As String
Dim m_FilePointer As Long
Dim i As Long, di As Long, n As Long
Set fs = New FileSystemObject
Set txt = fs.OpenTextFile(App.Path & "\BIG5.TXT")
For i = LBound(BIG5Order) To UBound(BIG5Order)
If Not txt.AtEndOfStream Then
strTemp = txt.ReadLine
If Right(strTemp, 1) <> Chr(34) Then
MsgBox "ERROR!", vbCritical
Else
strHex = Mid(strTemp, Len(strTemp) - 4, 4)
BIG5Order(i) = Val("&H" & strHex)
End If
DoEvents
Else
MsgBox "ERROR!", vbCritical
End If
Next i
m_FilePointer = CreateFile(App.Path & "\BIG5.DAT", GENERIC_READ Or GENERIC_WRITE, 0&, 0&, CREATE_NEW, FILE_ATTRIBUTE_NORMAL, 0&)
di = WriteFile(m_FilePointer, BIG5Order(0), Len(BIG5Order(0)) * (UBound(BIG5Order) + 1), n, 0&)
di = CloseHandle(m_FilePointer)
MsgBox "已经在" & App.Path & "下面生成了BIG5.DAT"
End Sub
Private Sub Command2_Click()
Dim fs As FileSystemObject
Dim txt As TextStream
Dim fileDat As String
Dim strTemp As String
Dim strHex As String
Dim m_FilePointer As Long
Dim i As Long, di As Long, n As Long
Set fs = New FileSystemObject
Set txt = fs.OpenTextFile(App.Path & "\GB.TXT")
For i = LBound(GBOrder) To UBound(GBOrder)
If Not txt.AtEndOfStream Then
strTemp = txt.ReadLine
If Right(strTemp, 1) <> Chr(34) Then
MsgBox "ERROR!", vbCritical
Else
strHex = Mid(strTemp, Len(strTemp) - 4, 4)
GBOrder(i) = Val("&H" & strHex)
End If
DoEvents
Else
MsgBox "ERROR!", vbCritical
End If
Next i
m_FilePointer = CreateFile(App.Path & "\GB.DAT", GENERIC_READ Or GENERIC_WRITE, 0&, 0&, CREATE_NEW, FILE_ATTRIBUTE_NORMAL, 0&)
di = WriteFile(m_FilePointer, GBOrder(0), Len(GBOrder(0)) * (UBound(GBOrder) + 1), n, 0&)
di = CloseHandle(m_FilePointer)
MsgBox "已经在" & App.Path & "下面生成了GB.DAT"
End Sub
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -