This Visual Basic 3.0 form uses the WinDES DLL to encrypt/decrypt onscreen text.
It can serve as a model for your own VB3-WinDES tools. Just copy the portion
of this file beyond the "cut here" line to the clipboard using NotePad and 
Paste it into "Form1" of a new VB Project. You won't need any custom controls; 
you'll only need the WinDES.DLL in your Windows System directory, along with
the Visual Basic 3 runtime library, VBRUN300.DLL.

=== cut here ===
VERSION 2.00
Begin Form WinDES_DEMO 
   BackColor       =   &H00C0C0C0&
   BorderStyle     =   1  'Fixed Single
   Caption         =   "WinDES Visual Basic Interface Demo"
   ClientHeight    =   6555
   ClientLeft      =   1890
   ClientTop       =   1590
   ClientWidth     =   8235
   FillColor       =   &H00C0C0C0&
   FontBold        =   -1  'True
   FontItalic      =   0   'False
   FontName        =   "Arial"
   FontSize        =   8.25
   FontStrikethru  =   0   'False
   FontUnderline   =   0   'False
   Height          =   6960
   Left            =   1830
   LinkTopic       =   "Form1"
   ScaleHeight     =   6555
   ScaleWidth      =   8235
   Top             =   1245
   Width           =   8355
   Begin CommandButton Quit 
      Caption         =   "Quit"
      FontBold        =   -1  'True
      FontItalic      =   0   'False
      FontName        =   "Arial"
      FontSize        =   8.25
      FontStrikethru  =   0   'False
      FontUnderline   =   0   'False
      Height          =   375
      Left            =   4560
      TabIndex        =   9
      Top             =   6000
      Width           =   975
   End
   Begin CommandButton DoIt 
      Caption         =   "Do It"
      Default         =   -1  'True
      FontBold        =   -1  'True
      FontItalic      =   0   'False
      FontName        =   "Arial"
      FontSize        =   8.25
      FontStrikethru  =   0   'False
      FontUnderline   =   0   'False
      Height          =   375
      Left            =   3360
      TabIndex        =   8
      Top             =   6000
      Width           =   975
   End
   Begin TextBox DesPlainText 
      Enabled         =   0   'False
      FontBold        =   -1  'True
      FontItalic      =   0   'False
      FontName        =   "Courier New"
      FontSize        =   9.75
      FontStrikethru  =   0   'False
      FontUnderline   =   0   'False
      Height          =   1335
      Left            =   1680
      MultiLine       =   -1  'True
      TabIndex        =   3
      Text            =   "Decrypted text - resulting from processing the encrypted text above with your Key."
      Top             =   4560
      Width           =   5895
   End
   Begin TextBox DesCryptoText 
      Enabled         =   0   'False
      FontBold        =   -1  'True
      FontItalic      =   0   'False
      FontName        =   "Courier New"
      FontSize        =   9.75
      FontStrikethru  =   0   'False
      FontUnderline   =   0   'False
      Height          =   1335
      Left            =   1680
      MultiLine       =   -1  'True
      TabIndex        =   2
      Text            =   "Encrypted text - resulting from Electronic Code Book (ECB) DES encryption using your Key on your Input text, above."
      Top             =   3120
      Width           =   5895
   End
   Begin TextBox DesInput 
      FontBold        =   -1  'True
      FontItalic      =   0   'False
      FontName        =   "Courier New"
      FontSize        =   9.75
      FontStrikethru  =   0   'False
      FontUnderline   =   0   'False
      Height          =   1335
      Left            =   1680
      MaxLength       =   248
      MultiLine       =   -1  'True
      TabIndex        =   1
      Text            =   "Plaintext input - text is processed in 8-byte blocks and allows multiple lines. This demo limits the input to 248 characters, although larger buffers may be used. Check this form's Declarations and DoIt_Click event code. Try it!"
      Top             =   1680
      Width           =   5895
   End
   Begin TextBox DesKey 
      FontBold        =   -1  'True
      FontItalic      =   0   'False
      FontName        =   "Courier New"
      FontSize        =   9.75
      FontStrikethru  =   0   'False
      FontUnderline   =   0   'False
      Height          =   360
      Left            =   1680
      MaxLength       =   8
      TabIndex        =   0
      Text            =   "8charkey"
      Top             =   1200
      Width           =   1095
   End
   Begin Label Label5 
      BackColor       =   &H00C0C0C0&
      Caption         =   "This form demonstrates the Visual Basic interface to the Windows' Data Encryption Standard Dynamic-Link Library (WinDES.DLL), a Shareware crypto-tool available for US and Canadian citizens only (even though DES is an established standard widely used in International Banking). To download a copy from CompuServe, GO WINSHARE and look for WINDES.ZIP."
      Enabled         =   0   'False
      FontBold        =   -1  'True
      FontItalic      =   0   'False
      FontName        =   "Arial"
      FontSize        =   8.25
      FontStrikethru  =   0   'False
      FontUnderline   =   0   'False
      Height          =   975
      Left            =   360
      TabIndex        =   10
      Top             =   120
      Width           =   7695
      WordWrap        =   -1  'True
   End
   Begin Label Label4 
      BackColor       =   &H00C0C0C0&
      Caption         =   "Decrypted:"
      Enabled         =   0   'False
      FontBold        =   -1  'True
      FontItalic      =   0   'False
      FontName        =   "Arial"
      FontSize        =   8.25
      FontStrikethru  =   0   'False
      FontUnderline   =   0   'False
      Height          =   255
      Left            =   360
      TabIndex        =   7
      Top             =   4560
      Width           =   1095
   End
   Begin Label Label3 
      BackColor       =   &H00C0C0C0&
      Caption         =   "Encrypted:"
      Enabled         =   0   'False
      FontBold        =   -1  'True
      FontItalic      =   0   'False
      FontName        =   "Arial"
      FontSize        =   8.25
      FontStrikethru  =   0   'False
      FontUnderline   =   0   'False
      Height          =   255
      Left            =   360
      TabIndex        =   6
      Top             =   3120
      Width           =   1095
   End
   Begin Label Label2 
      BackColor       =   &H00C0C0C0&
      Caption         =   "Your Input:"
      Enabled         =   0   'False
      FontBold        =   -1  'True
      FontItalic      =   0   'False
      FontName        =   "Arial"
      FontSize        =   8.25
      FontStrikethru  =   0   'False
      FontUnderline   =   0   'False
      Height          =   255
      Left            =   360
      TabIndex        =   5
      Top             =   1680
      Width           =   1095
   End
   Begin Label Label1 
      BackColor       =   &H00C0C0C0&
      Caption         =   "Your Key:"
      Enabled         =   0   'False
      FontBold        =   -1  'True
      FontItalic      =   0   'False
      FontName        =   "Arial"
      FontSize        =   8.25
      FontStrikethru  =   0   'False
      FontUnderline   =   0   'False
      Height          =   255
      Left            =   360
      TabIndex        =   4
      Top             =   1200
      Width           =   1095
   End
End
Option Explicit
Declare Sub DesEnCrypt Lib "WinDES.DLL" (ByVal lpKey$, ByVal lpInp$, ByVal lpOut$, ByVal wCnt%)
Declare Sub DesDeCrypt Lib "WinDES.DLL" (ByVal lpKey$, ByVal lpInp$, ByVal lpOut$, ByVal wCnt%)

Sub DoIt_Click ()
 Dim lpKey As String * 8    ' key is fixed at 8 bytes
 Dim lpInp As String * 248  ' buffers are multiple of 8 bytes
 Dim lpOut As String * 248  ' holds encrypted result
 Dim lpTxt As String * 248  ' holds decrypted result
 Dim wCnt As Integer        ' how many 8-byte blocks to process

 lpKey = String(8, 32)  ' prefill strings for DLL
 lpInp = String(248, 32)
 lpOut = String(248, 32)
 lpTxt = String(248, 32)
 wCnt = ((Len(RTrim(DesInput)) + 7) / 8)  ' round up
 lpKey = Left$(DesKey, 8)  ' prevent overrun
 lpInp = RTrim(DesInput)
 Call DesEnCrypt(lpKey, lpInp, lpOut, wCnt)
 DesCryptoText = Left$(lpOut, (wCnt * 8))
 Call DesDeCrypt(lpKey, lpOut, lpTxt, wCnt)
 DesPlainText = Left$(lpTxt, (wCnt * 8))
 Show
End Sub

Sub Quit_Click ()
 End
End Sub

=== cut here ===

