Find all our projects in development below.
All source code is GNU General Public License (GPL)
Browsing AutoAliasForm.frm (6.71 KB)
VERSION 5.00
Object = "{831FDD16-0C5C-11D2-A9FC-0000F8754DA1}#2.0#0"; "MSCOMCTL.OCX"
Begin VB.Form AutoAliasForm
BorderStyle = 3 'Fixed Dialog
Caption = "AutoAlias Setup"
ClientHeight = 2535
ClientLeft = 45
ClientTop = 330
ClientWidth = 6495
ClipControls = 0 'False
Icon = "AutoAliasForm.frx":0000
MaxButton = 0 'False
MinButton = 0 'False
ScaleHeight = 2535
ScaleWidth = 6495
ShowInTaskbar = 0 'False
StartUpPosition = 2 'CenterScreen
Begin VB.CommandButton Command6
Caption = "De&lete All"
Height = 375
Left = 5280
TabIndex = 4
Top = 1560
Width = 1095
End
Begin VB.CommandButton Command5
Caption = "&Delete"
Height = 375
Left = 5280
TabIndex = 3
Top = 1080
Width = 1095
End
Begin VB.CommandButton Command4
Caption = "&Add"
Height = 375
Left = 5280
TabIndex = 2
Top = 600
Width = 1095
End
Begin VB.CommandButton Command3
Caption = "E&dit"
Height = 375
Left = 5280
TabIndex = 1
Top = 120
Width = 1095
End
Begin VB.CommandButton Command2
Cancel = -1 'True
Caption = "Cancel"
Height = 375
Left = 5280
TabIndex = 7
Top = 2040
Width = 1095
End
Begin VB.CommandButton Command1
Caption = "OK"
Default = -1 'True
Height = 375
Left = 4080
TabIndex = 6
Top = 2040
Width = 1095
End
Begin VB.CheckBox Check1
Caption = "&Enable AutoAlias"
Height = 255
Left = 120
TabIndex = 5
Top = 2160
Value = 1 'Checked
Width = 3735
End
Begin MSComctlLib.ListView ListView1
Height = 1815
Left = 120
TabIndex = 0
Top = 120
Width = 5055
_ExtentX = 8916
_ExtentY = 3201
View = 3
LabelEdit = 1
Sorted = -1 'True
LabelWrap = -1 'True
HideSelection = -1 'True
FullRowSelect = -1 'True
_Version = 393217
ForeColor = -2147483640
BackColor = -2147483643
BorderStyle = 1
Appearance = 1
NumItems = 2
BeginProperty ColumnHeader(1) {BDD1F052-858B-11D1-B16A-00C0F0283628}
Text = "Recipient"
Object.Width = 4375
EndProperty
BeginProperty ColumnHeader(2) {BDD1F052-858B-11D1-B16A-00C0F0283628}
SubItemIndex = 1
Text = "Recipient Alias"
Object.Width = 4375
EndProperty
End
End
Attribute VB_Name = "AutoAliasForm"
Attribute VB_GlobalNameSpace = False
Attribute VB_Creatable = False
Attribute VB_PredeclaredId = True
Attribute VB_Exposed = False
Sub EnableControls(Value As Boolean)
Command3.Enabled = Value
Command5.Enabled = Value
Command6.Enabled = Value
End Sub
Private Sub Check1_Click()
If Check1.Value = 1 Then
If ListView1.ListItems.Count > 0 Then EnableControls True
Command4.Enabled = True
ListView1.Enabled = True
Else
EnableControls False
Command4.Enabled = False
ListView1.Enabled = False
End If
End Sub
Private Sub Command1_Click()
Dim i As Integer
AAOptn_Enabled = Check1.Value
SaveRegString HKEY_LOCAL_MACHINE, RegAppRoot, "AutoAliasEnabled", CStr(AAOptn_Enabled)
ReDim AA_List(ListView1.ListItems.Count)
If ListView1.ListItems.Count > 0 Then
For i = 1 To ListView1.ListItems.Count
With ListView1.ListItems(i)
AA_List(i).Recipient = .Text
AA_List(i).RecipientAlias = .SubItems(1)
SaveRegString HKEY_LOCAL_MACHINE, RegAppRoot, "AutoAlias[" & i & "].Recipient", .Text
SaveRegString HKEY_LOCAL_MACHINE, RegAppRoot, "AutoAlias[" & i & "].RecipientAlias", .SubItems(1)
End With
Next i
End If
SaveRegString HKEY_LOCAL_MACHINE, RegAppRoot, "AutoAliasCount", CStr(UBound(AA_List))
Unload Me
End Sub
Private Sub Command2_Click()
Unload Me
End Sub
Private Sub Command3_Click()
With EditAAForm
.Settings 1
.Text1.Text = ListView1.SelectedItem.Text
.Text1.SelStart = 0
.Text1.SelLength = Len(.Text1.Text)
.Text2.Text = ListView1.SelectedItem.SubItems(1)
.Show 1
End With
End Sub
Private Sub Command4_Click()
EditAAForm.Settings 0
EditAAForm.Show 1
End Sub
Private Sub Command5_Click()
Dim M As VbMsgBoxResult
M = MsgBox("Delete selected AutoAlias from list?", vbOKCancel + vbQuestion)
If M = vbOK Then
ListView1.ListItems.Remove ListView1.SelectedItem.Index
If ListView1.ListItems.Count = 0 Then EnableControls False
End If
End Sub
Private Sub Command6_Click()
Dim M As VbMsgBoxResult
M = MsgBox("Delete all AutoAliases from list?", vbOKCancel + vbQuestion)
If M = vbOK Then
ListView1.ListItems.Clear
EnableControls False
End If
End Sub
Private Sub Form_Load()
Dim i As Integer
Dim LI As Object
LV_FlatColumnHeaders ListView1
Command3.Font.Bold = True
If UBound(AA_List) > 0 Then
For i = 1 To UBound(AA_List)
Set LI = ListView1.ListItems.Add()
LI.Text = AA_List(i).Recipient
LI.SubItems(1) = AA_List(i).RecipientAlias
Set LI = Nothing
Next i
EnableControls True
Else
EnableControls False
End If
Check1.Value = AAOptn_Enabled
End Sub
Private Sub ListView1_Click()
On Error GoTo NoItemErr
If ListView1.SelectedItem.Selected = True Then EnableControls True
Exit Sub
NoItemErr:
EnableControls False
End Sub
Private Sub ListView1_ItemClick(ByVal Item As MSComctlLib.ListItem)
On Error GoTo NoItemErr
If ListView1.SelectedItem.Selected = True Then EnableControls True
Exit Sub
NoItemErr:
EnableControls False
End Sub