您的位置:首页 > 编程语言 > VB

[转]用VB实现简体繁体互换

2008-04-21 21:50 183 查看
Option Explicit
Private Declare Function LCMapString Lib "kernel32" Alias "LCMapStringA" (ByVal Locale As Long, ByVal dwMapFlags As Long, ByVal lpSrcStr As String, ByVal cchSrc As Long, ByVal lpDestStr As String, ByVal cchDest As Long) As Long
Private Declare Function lstrlen Lib "kernel32" Alias "lstrlenA" (ByVal lpString As String) As Long
Dim aa$, ii&
Private Sub Form_Load()
Command1.Caption = "简体转繁体"
Open "c:/cmd.txt" For Input As #1
Text1.Text = StrConv(InputB(LOF(1), 1), vbUnicode)
Close #1
End Sub

Private Sub Command1_Click()
ii = lstrlen(Text1.Text)
aa = Space(ii)
If Command1.Caption = "简体转繁体" Then
LCMapString &H804, &H4000000, Text1.Text, ii, aa, ii
Else
LCMapString &H804, &H2000000, Text1.Text, ii, aa, ii
End If
Text1.Text = aa
Command1.Caption = IIf(Command1.Caption = "繁体转简体", "简体转繁体", "繁体转简体")
End Sub
内容来自用户分享和网络整理,不保证内容的准确性,如有侵权内容,可联系管理员处理 点击这里给我发消息
标签: