Um eine Datei zu verschlüsseln dann schau hier rein vbarchiv.net/download/download_detail.php?pid=362
Text in TextBox Ver/entschlüsseln
4 Datei Eigenschaften auslesen
Text in TextBox Ver/entschlüsseln
Visual Basic-Quellcode
- Public Function EncodeString(ByVal strToEncode As String, _
- ByVal strPassword As String) As String
- Dim strResult As String
- Dim i As Long
- Dim cfc() As Integer
- ReDim cfc(1 To Len(strPassword))
- For i = 1 To UBound(cfc)
- cfc(i) = Asc(Right(strPassword, _
- Len(strPassword) - i + 1))
- Next i
- For i = 1 To Len(strToEncode)
- strResult = strResult & _
- Chr(addToIndex(Asc(Right(strToEncode, _
- Len(strToEncode) - i + 1)), VirtPos(i, cfc)))
- Next i
- EncodeString = strResult
- End Function
- ' Text in Verbindung mit einem Passwort entschlüsseln
- Public Function DecodeString(ByVal strToDecode As String, _
- ByVal strPassword As String) As String
- Dim strResult As String
- Dim i As Long
- Dim cfc() As Integer
- ReDim cfc(1 To Len(strPassword))
- ReDim ttc(1 To Len(strToDecode))
- For i = 1 To UBound(cfc)
- cfc(i) = Asc(Right(strPassword, _
- Len(strPassword) - i + 1))
- Next i
- For i = 1 To Len(strToDecode)
- strResult = strResult & _
- Chr(GetOfIndex(Asc(Right(strToDecode, _
- Len(strToDecode) - i + 1)), VirtPos(i, cfc)))
- Next i
- DecodeString = strResult
- End Function
- ' Hilfsfunktionen
- Private Function VirtPos(i As Long, _
- a() As Integer) As Integer
- If i > UBound(a) Then
- VirtPos = VirtPos(i - UBound(a), a)
- Else
- VirtPos = a(i)
- End If
- End Function
- Private Function addToIndex(i As Integer, _
- j As Integer) As Integer
- If i + j > 255 Then
- addToIndex = i + j - 255
- Else
- addToIndex = i + j
- End If
- End Function
- Private Function GetOfIndex(i As Integer, _
- j As Integer) As Integer
- If i - j < 0 Then
- GetOfIndex = i - j + 255
- Else
- GetOfIndex = i - j
- End If
- End Function
- ____________________________________________________________
- rivate Sub cmdEncode_Click()
- ' Verschlüsseln
- txtResult.Text = EncodeString(txtToEncode.Text, _
- txtPassword.Text)
- End Sub
- Private Sub cmdDecode_Click()
- ' Entschlüsseln
- txtResult.Text = DecodeString(txtResult.Text, _
- txtPassword.Text)
4 Datei Eigenschaften auslesen
Visual Basic-Quellcode
- ' zunächst die benötigten API-Deklarationen Private Declare Function ShellExecuteEx Lib "shell32.dll" _ (LPSHELLEXECUTEINFO As SHELLEXECUTEINFO) As Long Private Type SHELLEXECUTEINFO cbSize As Long fMask As Long hWnd As Long lpVerb As String lpFile As String lpParameters As String lpDirectory As String nShow As Long hInstApp As Long lpIDList As Long lpClass As String hkeyClass As Long dwHotKey As Long hIcon As Long hProcess As Long End Type Private Const SEE_MASK_FLAG_NO_UI = &H400 Private Const SEE_MASK_INVOKEIDLIST = &HC Private Const SEE_MASK_NOCLOSEPROCESS = &H40 ' Datei-Eigenschaften Dialog anzeigen Public Sub ShowFileInfoDlg(ByVal hWnd As Long, _ ByVal sFilename As String) Dim FILEINFO As SHELLEXECUTEINFO With FILEINFO .cbSize = Len(FILEINFO) .fMask = SEE_MASK_FLAG_NO_UI Or _ SEE_MASK_INVOKEIDLIST Or _ SEE_MASK_NOCLOSEPROCESS .hWnd = hWnd .lpVerb = "properties" .lpFile = sFileName End With Call ShellExecuteEx(FILEINFO) End Sub
Dieser Beitrag wurde bereits 1 mal editiert, zuletzt von „Agent“ ()