home *** CD-ROM | disk | FTP | other *** search
/ io Programmo 53 / IOPROG_53.ISO / soft / c++ / xceedbkp.exe / Recovery Wizard / Sources / frmThree.frm (.txt) < prev    next >
Encoding:
Visual Basic Form  |  1999-09-02  |  15.6 KB  |  461 lines

  1. VERSION 5.00
  2. Begin VB.Form frmThree 
  3.    BackColor       =   &H8000000B&
  4.    BorderStyle     =   1  'Fixed Single
  5.    Caption         =   "Xceed Recovery Wizard"
  6.    ClientHeight    =   4290
  7.    ClientLeft      =   45
  8.    ClientTop       =   330
  9.    ClientWidth     =   7425
  10.    HelpContextID   =   8235
  11.    Icon            =   "frmThree.frx":0000
  12.    LinkTopic       =   "Form1"
  13.    MaxButton       =   0   'False
  14.    ScaleHeight     =   4290
  15.    ScaleMode       =   0  'User
  16.    ScaleWidth      =   12874.76
  17.    Begin VB.ListBox lstKeys 
  18.       Height          =   960
  19.       Left            =   1920
  20.       Sorted          =   -1  'True
  21.       Style           =   1  'Checkbox
  22.       TabIndex        =   17
  23.       Top             =   2520
  24.       Width           =   3375
  25.    End
  26.    Begin VB.ListBox lstDates 
  27.       BackColor       =   &H8000000B&
  28.       Height          =   1035
  29.       Left            =   5520
  30.       TabIndex        =   16
  31.       Top             =   1080
  32.       Width           =   1695
  33.    End
  34.    Begin VB.ListBox lstFiles 
  35.       Height          =   1185
  36.       Left            =   1920
  37.       Sorted          =   -1  'True
  38.       Style           =   1  'Checkbox
  39.       TabIndex        =   13
  40.       Top             =   960
  41.       Width           =   3375
  42.    End
  43.    Begin VB.CommandButton cmdTemp 
  44.       Caption         =   "Restore"
  45.       Enabled         =   0   'False
  46.       Height          =   375
  47.       Left            =   4560
  48.       TabIndex        =   10
  49.       Top             =   3720
  50.       Width           =   1215
  51.    End
  52.    Begin VB.TextBox txtMaxDate 
  53.       BackColor       =   &H8000000B&
  54.       BeginProperty DataFormat 
  55.          Type            =   0
  56.          Format          =   "dd-MM-yy"
  57.          HaveTrueFalseNull=   0
  58.          FirstDayOfWeek  =   0
  59.          FirstWeekOfYear =   0
  60.          LCID            =   1033
  61.          SubFormatType   =   0
  62.       EndProperty
  63.       Enabled         =   0   'False
  64.       Height          =   285
  65.       Left            =   6120
  66.       TabIndex        =   2
  67.       Top             =   3000
  68.       Width           =   975
  69.    End
  70.    Begin VB.TextBox txtMinDate 
  71.       BackColor       =   &H8000000B&
  72.       BeginProperty DataFormat 
  73.          Type            =   0
  74.          Format          =   "dd/MM/yy"
  75.          HaveTrueFalseNull=   0
  76.          FirstDayOfWeek  =   0
  77.          FirstWeekOfYear =   0
  78.          LCID            =   1033
  79.          SubFormatType   =   0
  80.       EndProperty
  81.       Enabled         =   0   'False
  82.       Height          =   285
  83.       Left            =   6120
  84.       TabIndex        =   1
  85.       Top             =   2640
  86.       Width           =   975
  87.    End
  88.    Begin VB.CheckBox chkDate 
  89.       Caption         =   "Time Frame?"
  90.       Height          =   255
  91.       Left            =   5640
  92.       TabIndex        =   0
  93.       Top             =   2280
  94.       Width           =   1335
  95.    End
  96.    Begin VB.CommandButton cmdCancel 
  97.       Caption         =   "Cancel"
  98.       Height          =   375
  99.       Left            =   6000
  100.       TabIndex        =   6
  101.       Top             =   3720
  102.       Width           =   1215
  103.    End
  104.    Begin VB.CommandButton cmdNext 
  105.       Caption         =   "Next  >"
  106.       Height          =   375
  107.       Left            =   3120
  108.       TabIndex        =   3
  109.       Top             =   3720
  110.       Width           =   1215
  111.    End
  112.    Begin VB.CommandButton cmdPrev 
  113.       Caption         =   "<  Previous"
  114.       Height          =   375
  115.       Left            =   1920
  116.       TabIndex        =   4
  117.       Top             =   3720
  118.       Width           =   1215
  119.    End
  120.    Begin VB.Label lblActivity 
  121.       Alignment       =   2  'Center
  122.       Caption         =   "Browsing catalogs for available entries"
  123.       Height          =   855
  124.       Left            =   360
  125.       TabIndex        =   18
  126.       Top             =   2160
  127.       Visible         =   0   'False
  128.       Width           =   975
  129.    End
  130.    Begin VB.Label Label8 
  131.       Caption         =   "Available dates for the selected file:"
  132.       Height          =   375
  133.       Left            =   5520
  134.       TabIndex        =   15
  135.       Top             =   600
  136.       Width           =   1695
  137.    End
  138.    Begin VB.Label Label7 
  139.       Caption         =   "Available registry keys:"
  140.       Height          =   255
  141.       Left            =   1920
  142.       TabIndex        =   14
  143.       Top             =   2280
  144.       Width           =   1695
  145.    End
  146.    Begin VB.Label Label6 
  147.       Caption         =   "Available files:"
  148.       Height          =   255
  149.       Left            =   1920
  150.       TabIndex        =   12
  151.       Top             =   720
  152.       Width           =   1095
  153.    End
  154.    Begin VB.Line Line1 
  155.       BorderColor     =   &H80000011&
  156.       Index           =   0
  157.       X1              =   2913.077
  158.       X2              =   2913.077
  159.       Y1              =   120
  160.       Y2              =   4080
  161.    End
  162.    Begin VB.Line Line1 
  163.       BorderColor     =   &H80000009&
  164.       Index           =   1
  165.       X1              =   2939.086
  166.       X2              =   2939.086
  167.       Y1              =   120
  168.       Y2              =   4080
  169.    End
  170.    Begin VB.Label Label5 
  171.       Caption         =   "Step 2 of 4"
  172.       BeginProperty Font 
  173.          Name            =   "MS Sans Serif"
  174.          Size            =   8.25
  175.          Charset         =   0
  176.          Weight          =   700
  177.          Underline       =   0   'False
  178.          Italic          =   0   'False
  179.          Strikethrough   =   0   'False
  180.       EndProperty
  181.       Height          =   255
  182.       Left            =   120
  183.       TabIndex        =   11
  184.       Top             =   3840
  185.       Width           =   1095
  186.    End
  187.    Begin VB.Image Image1 
  188.       Height          =   1260
  189.       Left            =   120
  190.       Picture         =   "frmThree.frx":0BC2
  191.       Top             =   120
  192.       Width           =   1410
  193.    End
  194.    Begin VB.Label Label4 
  195.       Caption         =   "End"
  196.       Height          =   255
  197.       Left            =   5640
  198.       TabIndex        =   9
  199.       Top             =   3000
  200.       Width           =   375
  201.    End
  202.    Begin VB.Label Label3 
  203.       Caption         =   "Begin"
  204.       Height          =   255
  205.       Left            =   5640
  206.       TabIndex        =   8
  207.       Top             =   2640
  208.       Width           =   495
  209.    End
  210.    Begin VB.Label Label2 
  211.       Caption         =   "What would you like to restore?"
  212.       Height          =   255
  213.       Left            =   1920
  214.       TabIndex        =   7
  215.       Top             =   360
  216.       Width           =   2655
  217.    End
  218.    Begin VB.Label Label1 
  219.       Caption         =   "File and Registry key selection"
  220.       BeginProperty Font 
  221.          Name            =   "MS Sans Serif"
  222.          Size            =   8.25
  223.          Charset         =   0
  224.          Weight          =   700
  225.          Underline       =   -1  'True
  226.          Italic          =   0   'False
  227.          Strikethrough   =   0   'False
  228.       EndProperty
  229.       Height          =   255
  230.       Left            =   1920
  231.       TabIndex        =   5
  232.       Top             =   120
  233.       Width           =   2895
  234.    End
  235. Attribute VB_Name = "frmThree"
  236. Attribute VB_GlobalNameSpace = False
  237. Attribute VB_Creatable = False
  238. Attribute VB_PredeclaredId = True
  239. Attribute VB_Exposed = False
  240. Option Explicit
  241. Private Declare Function SendMessage Lib "user32" Alias "SendMessageA" (ByVal hwnd As Long, ByVal wMsg As Long, ByVal wParam As Long, lParam As Any) As Long
  242. Private Const LB_GETITEMHEIGHT = &H1A1
  243. Dim xClass As clsXceed
  244. Dim ExitInc As Integer
  245. Dim cFileDates As Collection
  246. Dim WithEvents xLocalMain As XceedBackup
  247. Attribute xLocalMain.VB_VarHelpID = -1
  248. Public Function ShowForm(xObjects As clsXceed) As Integer
  249.     'This is where you will fill in the fields on your forms with the values
  250.     'in xObjects.
  251.     txtMinDate.Text = xObjects.xSelection.MinDate
  252.     txtMaxDate.Text = xObjects.xSelection.MaxDate
  253.     Set xClass = xObjects
  254.     Me.Left = xClass.PositionLeft
  255.     Me.Top = xClass.PositionTop
  256.     'Browse for files in the background
  257.     xClass.xSelection.FilesToProcess = "*<R>"
  258.     xClass.xSelection.FilesToExclude = ""
  259.     xClass.xSelection.MinDate = bkpMinimumDate
  260.     xClass.xSelection.MaxDate = bkpMaximumDate
  261.     xClass.xSelection.RegKeysToInclude = "*"
  262.     xClass.xMain.BackgroundProcessing = True
  263.     ' Reset lists and collections
  264.     Set cFileDates = Nothing
  265.     Set cFileDates = New Collection
  266.     lstFiles.Clear
  267.     lstKeys.Clear
  268.     ' We want our own form to receive events, so launch process from our variable
  269.     Set xLocalMain = xClass.xMain
  270.     xLocalMain.BrowseCatalogs xClass.xSelection, xClass.xRestore.BackupSetName
  271.     ' Show label about background processing
  272.     lblActivity.Visible = True
  273.     Me.Show vbModal
  274.     ' Abort browsing in case not over yet
  275.     xLocalMain.Abort = True
  276.     ' Reset foreground mode
  277.     xLocalMain.BackgroundProcessing = False
  278.     ' Remove our reference on this object
  279.     Set xLocalMain = Nothing
  280.     xClass.PositionLeft = Me.Left
  281.     xClass.PositionTop = Me.Top
  282.     Set xClass = Nothing
  283.     'At this point, the form is now hidden and ExitInc contains the increment.
  284.     'If ExitInc is not 0 then set xobjects to the field values.
  285.     If ExitInc <> 0 Then
  286.         If chkDate.Value = vbUnchecked Then
  287.             xObjects.xSelection.MinDate = bkpMinimumDate
  288.             xObjects.xSelection.MaxDate = bkpMaximumDate
  289.         Else
  290.              xObjects.xSelection.MinDate = txtMinDate.Text
  291.              xObjects.xSelection.MaxDate = txtMaxDate.Text
  292.         End If
  293.                 
  294.         ' Keep the list of selected files
  295.         Dim i As Long
  296.         xObjects.MaxSelectedFiles = lstFiles.SelCount
  297.         
  298.         For i = 0 To lstFiles.ListCount - 1
  299.             If lstFiles.Selected(i) Then
  300.                 xObjects.AddSelectedFiles (lstFiles.List(i))
  301.             End If
  302.         Next i
  303.                 
  304.         ' Keep the list of selected registry keys
  305.         xObjects.MaxSelectedKeys = lstKeys.SelCount
  306.         
  307.         For i = 0 To lstKeys.ListCount - 1
  308.             If lstKeys.Selected(i) Then
  309.                 xObjects.AddSelectedKeys (lstKeys.List(i))
  310.             End If
  311.         Next i
  312.     End If
  313.     ShowForm = ExitInc
  314. End Function
  315. Private Function FindStringInList(lstItems As ListBox, sFind As String) As Integer
  316.     Dim i As Integer
  317.     For i = 0 To lstItems.ListCount - 1
  318.         If lstItems.List(i) = sFind Then
  319.             FindStringInList = i
  320.             Exit Function
  321.         End If
  322.     Next i
  323.     FindStringInList = -1
  324. End Function
  325. Private Sub chkDate_Click()
  326.     If chkDate = vbChecked Then
  327.         txtMinDate.Enabled = True
  328.         txtMaxDate.Enabled = True
  329.         txtMinDate.BackColor = &H80000005
  330.         txtMaxDate.BackColor = &H80000005
  331.     Else
  332.         txtMinDate.Enabled = False
  333.         txtMaxDate.Enabled = False
  334.         txtMinDate.BackColor = &H8000000B
  335.         txtMaxDate.BackColor = &H8000000B
  336.     End If
  337.         
  338. End Sub
  339. Private Sub cmdCancel_Click()
  340.     Dim Answer As VbMsgBoxResult
  341.     Answer = MsgBox("Your backups have not yet been restored. Cancel anyway?", vbYesNo + vbQuestion)
  342.     If Answer = vbYes Then
  343.         ExitInc = 0
  344.         Me.Hide
  345.     End If
  346.      
  347. End Sub
  348. Private Sub cmdNext_Click()
  349.     Dim Answer As VbMsgBoxResult
  350.        
  351.     If lstFiles.SelCount = 0 And lstKeys.SelCount = 0 Then
  352.         Answer = MsgBox("You must select some files or registry keys to restore before proceeding.", vbOKOnly + vbInformation)
  353.     Else
  354.         ExitInc = 1
  355.         Me.Hide
  356.     End If
  357. End Sub
  358. Private Sub cmdPrev_Click()
  359.         ExitInc = -1
  360.         Me.Hide
  361. End Sub
  362. Private Sub Form_QueryUnload(Cancel As Integer, UnloadMode As Integer)
  363.     If UnloadMode <> vbFormCode Then
  364.         Cancel = True
  365.         Call cmdCancel_Click
  366.     End If
  367. End Sub
  368. Private Sub lstFiles_Click()
  369.     ' Update available dates list
  370.     lstDates.Clear
  371.     If lstFiles.ListIndex > -1 Then
  372.         Dim xFileDates As clsDateList
  373.         Dim i As Integer
  374.         
  375.         Set xFileDates = cFileDates.Item(Str(lstFiles.ItemData(lstFiles.ListIndex)))
  376.         
  377.         For i = 0 To xFileDates.Count - 1
  378.             lstDates.AddItem xFileDates.FileDate(i)
  379.         Next i
  380.     End If
  381. End Sub
  382. Private Sub lstFiles_MouseMove(Button As Integer, Shift As Integer, X As Single, Y As Single)
  383.     ' Little trick to show full filename in tooltip
  384.     Dim lItemHeight As Long
  385.     Dim nIndex As Integer
  386.     lItemHeight = SendMessage(lstFiles.hwnd, LB_GETITEMHEIGHT, 0, 0)
  387.     nIndex = lstFiles.TopIndex + (Y \ 15 \ lItemHeight)
  388.     If nIndex > lstFiles.ListCount - 1 Or nIndex < 0 Then
  389.         lstFiles.ToolTipText = ""
  390.     Else
  391.         lstFiles.ToolTipText = lstFiles.List(nIndex)
  392.     End If
  393. End Sub
  394. Private Sub lstKeys_MouseMove(Button As Integer, Shift As Integer, X As Single, Y As Single)
  395.     ' Little trick to show full filename in tooltip
  396.     Dim lItemHeight As Long
  397.     Dim nIndex As Integer
  398.     lItemHeight = SendMessage(lstKeys.hwnd, LB_GETITEMHEIGHT, 0, 0)
  399.     nIndex = lstKeys.TopIndex + (Y \ 15 \ lItemHeight)
  400.     If nIndex > lstKeys.ListCount - 1 Or nIndex < 0 Then
  401.         lstKeys.ToolTipText = ""
  402.     Else
  403.         lstKeys.ToolTipText = lstKeys.List(nIndex)
  404.     End If
  405. End Sub
  406. Private Sub xLocalMain_BrowsingCatalogEntry(ByVal sFilename As String, ByVal lSize As Long, ByVal xAttributes As XceedBackupLib.bkpFileAttributes, ByVal dtLastModified As Date, ByVal dtLastAccessed As Date, ByVal dtCreated As Date, ByVal lDiskNumber As Long, ByVal sMediaLabel As String)
  407.     Dim nIndex As Integer
  408.     Dim i As Long
  409.     If Len(sFilename) > 4 And Left(sFilename, 4) = "HKEY" Then
  410.         nIndex = FindStringInList(lstKeys, sFilename)
  411.         If nIndex = -1 Then
  412.             lstKeys.AddItem sFilename
  413.             nIndex = lstKeys.NewIndex
  414.             
  415.             ' Check if already in selected list
  416.             For i = 0 To xClass.SelectedKeysCount - 1
  417.                 If xClass.SelectedKeys(i) = sFilename Then
  418.                     lstKeys.Selected(nIndex) = True
  419.                     Exit For
  420.                 End If
  421.             Next i
  422.         End If
  423.     Else
  424.         Dim xFileDates As clsDateList
  425.         
  426.         nIndex = FindStringInList(lstFiles, sFilename)
  427.         If nIndex = -1 Then
  428.             Dim lKey As Long
  429.             
  430.             Set xFileDates = New clsDateList
  431.             
  432.             xFileDates.AddItem dtLastModified
  433.             lstFiles.AddItem sFilename
  434.             nIndex = lstFiles.NewIndex
  435.             
  436.             lKey = cFileDates.Count
  437.             cFileDates.Add xFileDates, Str(lKey)
  438.             lstFiles.ItemData(nIndex) = lKey
  439.             
  440.             ' Check if already in selected list
  441.             For i = 0 To xClass.SelectedFilesCount - 1
  442.                 If xClass.SelectedFiles(i) = sFilename Then
  443.                     lstFiles.Selected(nIndex) = True
  444.                     Exit For
  445.                 End If
  446.             Next i
  447.         Else
  448.             Set xFileDates = cFileDates.Item(Str(lstFiles.ItemData(nIndex)))
  449.             
  450.             xFileDates.AddItem dtLastModified
  451.         End If
  452.     End If
  453. End Sub
  454. Private Sub xLocalMain_ProcessCompleted(ByVal lFilesTotal As Long, ByVal lFilesProcessed As Long, ByVal lFilesSkipped As Long, ByVal lBytesTotal As Long, ByVal lBytesProcessed As Long, ByVal lBytesSkipped As Long, ByVal xResult As XceedBackupLib.bkpError)
  455.     ' Hide activity label
  456.     lblActivity.Visible = False
  457.     ' Force update of available dates list
  458.     Call lstFiles_Click
  459.     Debug.Print xResult
  460. End Sub
  461.