Private Sub CmdSplit_Click()
Dim sBmpFileName As String
Dim sFileName As String
Dim sPassword As String
Dim sfile
'sBmpFileName = Text1.Text
sFileName = Text2.Text
sPassword = txtPassword.Text
'sfile = sBmpFileName
If sPassword = "" Then
MsgBox " 请输入密码 ! ", vbOKOnly + vbExclamation, " 注意 "
Timer1.Enabled = True
Exit Sub
End If
If OptionJ1.Value = True Then
sBmpFileName = CD1.FileName
Call splitotherfileJ(sBmpFileName, sFileName, sPassword) ' 调用分离出密文的子程序
MsgBox " 文件解密完毕,请选择适当方式查看密文! ", vbOKOnly + vbInformation, " 祝贺你 "
Text4.BackColor = &HFFC0C0
Text4.Font = "楷体"
Open (CommonDialog2.FileName) For Output Access Write As #4
Print #4, Text4.Text '将rich1.Text的内容写入文件号为4的文件
Close #4
End If
If OptionJ2.Value = True Then
If rich1.Text = "" Then ' 判断密文是否为空
MsgBox " 文件为空,请选择有效文件! ", vbOKOnly + vbExclamation, " 注意 "
Exit Sub
End If
If rich1.Text <> "" Then
Text4.Text = DES.DecryptString(rich1.Text, txtPassword.Text)
Text4.BackColor = &HFFC0C0
Text4.Font = "楷体"
End If
Open (CommonDialog2.FileName) For Output Access Write As #4
Print #4, Text4.Text '将rich1.Text的内容写入文件号为4的文件
Close #4
MsgBox "文件解密完毕! ", vbOKOnly + vbInformation, " 祝贺你 "
End If
Dim FileName As String
Dim pass() As Byte
Dim KeyBits As Long
Dim BlockBits As Long
If OptionJ3.Value = True Then
If rich1.Text = "" Then ' 判断密文是否为空
MsgBox " 文件为空,请选择有效文件! ", vbOKOnly + vbExclamation, " 注意 "
Exit Sub
End If
If rich1.Text <> "" Then
FileName = Text2.Text
If Len(FileName) <> 0 Then
If InStrRev(FileName, ".txt") = Len(FileName) - 3 Then FileName2 = Left$(FileName, Len(FileName) - 4)
FileName2 = FileDialog(Me, True, "解密数据另存为:", "另存为 |*.*|*.txt|*.aes|*.*")
If Len(FileName2) <> 0 Then
RidFile FileName2
KeyBits = cboKeySize.ItemData(cboKeySize.ListIndex)
BlockBits = cboBlockSize.ItemData(cboBlockSize.ListIndex)
pass = GetPassword
Status = "Decrypting File"
#If SUPPORT_LEVEL Then
m_Rijndael.SetCipherKey pass, KeyBits, BlockBits
m_Rijndael.FileDecrypt FileName2, FileName, BlockBits
#Else
m_Rijndael.SetCipherKey pass, KeyBits
m_Rijndael.FileDecrypt FileName2, FileName
#End If
Status = ""
End If
End If