Народ помогите. Программа написанна на Visual Studio 2005,а мне нужно что бы она работала на VB6. А VB6 не поддерживает некоторые функции.Помогите пожалуйста.
Option Compare Text
Public Class Form1
Dim curtxt, enctxt, ch(34) As String
Dim key(255) As Integer
Const chnum = 34
Sub keystring_decomp(ByVal ss As String)
Dim i, j, indx As Integer
key(0) = Len(ss)
For i = 1 To key(0)
indx = 0
For j = 1 To chnum
If Mid(ss, i, 1) = ch(j) Then indx = j - 1
Next
key(i) = indx
Next
End Sub
Function slidechar(ByVal ccchar As String, ByVal offfst As Integer) As String
Dim i, indx As Integer
indx = 0
For i = 1 To chnum
If ccchar = ch(i) Then indx = i
Next
If indx = 0 Then
Return (".")
GoTo l1
End If
indx = indx + offfst
If indx > chnum Then indx = indx - chnum
If indx < 1 Then indx = indx + chnum
Return (ch(indx))
l1:
End Function
Private Sub Button1_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button1.Click
curtxt = My.Computer.FileSystem.ReadAllText(TextBox3.Text)
TextBox4.Text = curtxt
End Sub
Private Sub Button2_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button2.Click
curtxt = TextBox4.Text
My.Computer.FileSystem.WriteAllText(TextBox3.Text, curtxt, True)
End Sub
Private Sub Button3_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button3.Click
Dim stlen, i, keypos, offst As Integer
curtxt = TextBox4.Text
stlen = Len(curtxt)
If stlen = 0 Then
MsgBox("нечего шифровать: " + curtxt)
Exit Sub
End If
keystring_decomp(TextBox1.Text)
keypos = 1 enctxt = ""
For i = 1 To stlen
enctxt = enctxt + slidechar(Mid(curtxt, i, 1), key(keypos))
keypos = keypos + 1
If keypos > key(0) Then keypos = 1
Next
curtxt = enctxt
offst = Val(TextBox2.Text)
enctxt = ""
For i = 1 To stlen
enctxt = enctxt + slidechar(Mid(curtxt, i, 1), offst)
Next
TextBox4.Text = enctxt
End Sub
Private Sub Form1_Load(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles MyBase.Load
ch(1) = " " : ch(2) = "а" : ch(3) = "б" : ch(4) = "в" : ch(5) = "г" : ch(6) = "д" : ch(7) = "е" : ch(8) = "ё" : ch(9) = "ж" : ch(10) = "з" : ch(11) = "и" : ch(12) = "й" : ch(13) = "к" : ch(14) = "л" : ch(15) = "м" : ch(16) = "н" : ch(17) = "о"
ch(18) = "п" : ch(19) = "р" : ch(20) = "с" : ch(21) = "т" : ch(22) = "у" : ch(23) = "ф" : ch(24) = "х" : ch(25) = "ц" : ch(26) = "ч" : ch(27) = "ш" : ch(28) = "щ" : ch(29) = "ь" : ch(30) = "ы" : ch(31) = "ъ" : ch(32) = "э" : ch(33) = "ю" : ch(34) = "я"
End Sub
Private Sub Button4_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button4.Click
Dim stlen, i, keypos, offst As Integer
curtxt = TextBox4.Text
stlen = Len(curtxt)
If stlen = 0 Then
MsgBox("нечего дешифровать: " + curtxt)
Exit Sub
End If
offst = Val(TextBox2.Text)
enctxt = ""
For i = 1 To stlen
enctxt = enctxt + slidechar(Mid(curtxt, i, 1), -offst)
Next
curtxt = enctxt
keystring_decomp(TextBox1.Text)
keypos = 1
enctxt = ""
For i = 1 To stlen
enctxt = enctxt + slidechar(Mid(curtxt, i, 1), -key(keypos))
keypos = keypos + 1
If keypos > key(0) Then keypos = 1
Next
TextBox4.Text = enctxt
End Sub
End Class