home *** CD-ROM | disk | FTP | other *** search
/ Chip 2003 May / CHIPCD200305.iso / super / altn / md_en.exe / USERPROPERTYFRM.FRM (.txt) < prev    next >
Encoding:
Visual Basic Form  |  2001-10-15  |  5.5 KB  |  178 lines

  1. VERSION 5.00
  2. Begin VB.Form UserPropertyFrm 
  3.    BorderStyle     =   3  'Fixed Dialog
  4.    Caption         =   "User Property"
  5.    ClientHeight    =   3195
  6.    ClientLeft      =   45
  7.    ClientTop       =   330
  8.    ClientWidth     =   6225
  9.    LinkTopic       =   "Form1"
  10.    MaxButton       =   0   'False
  11.    MinButton       =   0   'False
  12.    ScaleHeight     =   3195
  13.    ScaleWidth      =   6225
  14.    ShowInTaskbar   =   0   'False
  15.    StartUpPosition =   3  'Windows Default
  16.    Begin VB.ComboBox cmbDomains 
  17.       Height          =   315
  18.       ItemData        =   "UserPropertyFrm.frx":0000
  19.       Left            =   3240
  20.       List            =   "UserPropertyFrm.frx":0002
  21.       Style           =   2  'Dropdown List
  22.       TabIndex        =   9
  23.       Top             =   240
  24.       Width           =   2895
  25.    End
  26.    Begin VB.TextBox txtAccount 
  27.       Height          =   285
  28.       Left            =   1200
  29.       TabIndex        =   7
  30.       Text            =   "Text1"
  31.       Top             =   240
  32.       Width           =   1695
  33.    End
  34.    Begin VB.CommandButton btnCancel 
  35.       Cancel          =   -1  'True
  36.       Caption         =   "&Cancel"
  37.       Height          =   375
  38.       Left            =   4800
  39.       TabIndex        =   6
  40.       Top             =   2640
  41.       Width           =   1215
  42.    End
  43.    Begin VB.CommandButton btnOK 
  44.       Caption         =   "&OK"
  45.       Height          =   375
  46.       Left            =   3360
  47.       TabIndex        =   5
  48.       Top             =   2640
  49.       Width           =   1215
  50.    End
  51.    Begin VB.TextBox txtMailDir 
  52.       Height          =   285
  53.       Left            =   120
  54.       TabIndex        =   3
  55.       Text            =   "Text1"
  56.       Top             =   2040
  57.       Width           =   6015
  58.    End
  59.    Begin VB.CheckBox chkAllowAccess 
  60.       Caption         =   "Allow this account to be accessed with a POP/IMAP client"
  61.       Height          =   255
  62.       Left            =   480
  63.       TabIndex        =   2
  64.       Top             =   1320
  65.       Width           =   4695
  66.    End
  67.    Begin VB.TextBox txtFullName 
  68.       Height          =   285
  69.       Left            =   1200
  70.       TabIndex        =   1
  71.       Text            =   "Text1"
  72.       Top             =   840
  73.       Width           =   4935
  74.    End
  75.    Begin VB.Label Label4 
  76.       Caption         =   "Account:"
  77.       Height          =   255
  78.       Left            =   360
  79.       TabIndex        =   10
  80.       Top             =   240
  81.       Width           =   855
  82.    End
  83.    Begin VB.Label Label3 
  84.       Caption         =   "@"
  85.       Height          =   255
  86.       Left            =   3000
  87.       TabIndex        =   8
  88.       Top             =   240
  89.       Width           =   375
  90.    End
  91.    Begin VB.Label Label2 
  92.       Caption         =   "Mail Directory:"
  93.       Height          =   255
  94.       Left            =   120
  95.       TabIndex        =   4
  96.       Top             =   1800
  97.       Width           =   1815
  98.    End
  99.    Begin VB.Label Label1 
  100.       Caption         =   "Full Name:"
  101.       Height          =   255
  102.       Left            =   360
  103.       TabIndex        =   0
  104.       Top             =   840
  105.       Width           =   855
  106.    End
  107. Attribute VB_Name = "UserPropertyFrm"
  108. Attribute VB_GlobalNameSpace = False
  109. Attribute VB_Creatable = False
  110. Attribute VB_PredeclaredId = True
  111. Attribute VB_Exposed = False
  112. Public mEmail As String
  113. Public mRetval As Integer
  114. Private mUserInfo As MDUserInfo
  115. Private mhUser As MD_HANDLE
  116. 'A sub routine to load the MDUserInfo items to the controls
  117. Private Sub LoadInfoToForm()
  118.     txtAccount.Text = mUserInfo.MailBox
  119.     txtFullName.Text = mUserInfo.FullName
  120.     txtMailDir.Text = mUserInfo.MailDir
  121.     chkAllowAccess.Value = mUserInfo.AllowAccess
  122.     cmbDomains.Clear
  123.     Dim sDomains() As Variant
  124.     Dim sDom As Variant
  125.     'Get the list of domains
  126.     gMDUser.GetDomainNames sDomains
  127.     For Each sDom In sDomains
  128.         cmbDomains.AddItem sDom
  129.     Next sDom
  130.     cmbDomains.Text = mUserInfo.Domain
  131. End Sub
  132. 'A function to load the MDUserInfo from the controls
  133. Private Function LoadInfoFromForm() As Boolean
  134.     If txtFullName.Text = "" Or txtMailDir.Text = "" Or txtAccount.Text = "" Then
  135.         LoadInfoFromForm = False
  136.         Exit Function
  137.     End If
  138.     mUserInfo.FullName = txtFullName.Text
  139.     mUserInfo.MailDir = txtMailDir.Text
  140.     mUserInfo.AllowAccess = chkAllowAccess.Value
  141.     mUserInfo.MailBox = txtAccount.Text
  142.     mUserInfo.Domain = cmbDomains.Text
  143.     LoadInfoFromForm = True
  144. End Function
  145. Private Sub btnCancel_Click()
  146.     Unload UserPropertyFrm
  147. End Sub
  148. Private Sub btnOK_Click()
  149.     If LoadInfoFromForm And gMDUser.VerifyUserInfo(mUserInfo, MDUSERDLL_VRFYALL) = MDDLLERR_NOERROR Then
  150.         gMDUser.SetUserInfo mhUser, mUserInfo
  151.     Else
  152.         MsgBox "Could not validate account info.  Please make sure that all entries are valid.", vbCritical
  153.         Exit Sub
  154.     End If
  155.     mRetval = 1
  156.     Unload UserPropertyFrm
  157. End Sub
  158. Private Sub Form_Load()
  159.     mhUser = gMDUser.GetByEmail(mEmail)
  160.     If mhUser <> MD_BADHANDLE Then
  161.         'Create an instance of MDUserInfo
  162.         Set mUserInfo = New MDUserInfo
  163.         
  164.         'Get the MDUserInfo object associated with the user handle
  165.         gMDUser.GetUserInfo mhUser, mUserInfo
  166.         
  167.         LoadInfoToForm
  168.     End If
  169.     mRetval = 0
  170. End Sub
  171. Private Sub Form_Unload(Cancel As Integer)
  172.     If mhUser <> MD_BADHANDLE Then
  173.         Set mUserInfo = Nothing
  174.         'Free the user handle
  175.         gMDUser.GetFree mhUser
  176.     End If
  177. End Sub
  178.