VB高手请进,在线等!跪求答案

设计一个如图所示的文件加密程序。(窗体上有文件系统控件,组合框,文本框,1个命令按纽,1个进度条(ProgressBar1)和一个通用对话框。要求组合框存放规定的*。txt、*。dat的扩展名,文件列表框仅显示扩展名为组合框内规定的文件。在文件列表框双击选中的文件时,则在文本框Text1显示该文件的内容,进度条同时指示读入的进度。当单击“加密并存盘”按纽时,将读入的文本加密,在文本框Text2显示加密的效果,同时通过通用对话框将加密后的结果另存一文件。程序如下:
文件系统控件和组合的事件过程请看例2
sub form_load()
combol1.additem"*.txt"
combol1.additem"*.dat"
combol1.text="*.txt"
file1.pattern="*.txt"
end sub
sub file1_dblclick()
dim inputdata as string * 1
tfilename=iif(right(file1.path,1)="\",file1.path+file1.filename,_file1.payh+"\" + fil1.filename)
open tfilename for input as # 1
text1.text=""
with progressbar1
.min=0
.max=LOF(1)
.visible=true
.value=0
end with
do while not eof(1)
inputdata=input(1,#1)
text1.text=text1.text+inputdata
progressbar1.value=progressbar1.value+1
loop
progressbar1.value=0
close # 1
end sub
sub command1_click()
………(加密程序段,见例6。14)
.commomdialog1.filename for output as # 1
for i = 1 to len(text1.text)
print # 1,mid(text1.text,i,1);
next i
close # 1
end sub

例6。14
Dim strinput$, code$, record$, c As String * 1
Dim i%, length%, iasc%

Private Sub Command3_Click()
txtCode.Text = ""
txtRecode.Text = ""
txtInput.Text
End Sub

Private Sub Command3_Click()
Dim strinput$, code$, record$, c As String * 1
Dim i%, length%, iasc%
strinput = txtinput.Text
lengh = Len(RTrim(strinput))
code = ""
For i = 1 To lengh
c = Mid$(strinput, i, 1)
Select Case c
Case "a" To "z"
iasc = Asc(c) + 5
If iasc > Asc("z") Then iasc = iasc - 26
code = code + Chr$(iasc)
Case "a" To "z"
iasc = Asc(c) + 5
If iasc > Asc("z") Then iasc = iasc - 26
code = code = Chr$(iasc)
Case Else
Next i
txtcode.Text = code
End Sub
Private Sub Command3_Click()
txtcode.Text = ""
txtrecode.Text = ""
txtinput.Text = ""
End Sub
commondialogl.action=2
open commondialogl.filename for output as #1
FOR I =1 TO len(text1.text)
print#1,mid*(text1.text.i,1)
next i
close#1
end sub
若安加上解密的命令按纽

Const SND_ASYNC = &H1
Const SND_NODEFAULT = &H2
Const SND_LOOP = &H8
Const SND_NOSTOP = &H10

接下来把下面的代码粘贴到你想播放声音文件的地方,比如放在命令按钮的Click事件中

Dim sFlags As Long

sFlags = SND_ASYNC Or SND_NODEFAULT
温馨提示:内容为网友见解,仅供参考
第1个回答  2008-06-26
问题是什么呢?
相似回答