home *** CD-ROM | disk | FTP | other *** search
- VERSION 5.00
- Object = "{F43F7176-5DB4-11D1-A549-0020AF498497}#1.0#0"; "SortSolX.ocx"
- Object = "{F9043C88-F6F2-101A-A3C9-08002B2F49FB}#1.1#0"; "COMDLG32.OCX"
- Object = "{6B7E6392-850A-101B-AFC0-4210102A8DA7}#1.2#0"; "COMCTL32.OCX"
- Begin VB.Form SosoForm
- Caption = "Sort Solution ActiveX Demo"
- ClientHeight = 2925
- ClientLeft = 60
- ClientTop = 315
- ClientWidth = 6615
- LinkTopic = "Form1"
- ScaleHeight = 2925
- ScaleWidth = 6615
- StartUpPosition = 3 'Windows Default
- Begin VB.CommandButton BtnAbort
- Caption = "&Abort"
- Height = 495
- Left = 1800
- TabIndex = 8
- Top = 960
- Width = 1335
- End
- Begin ComctlLib.ProgressBar ProgressBarMerge
- Height = 255
- Left = 1560
- TabIndex = 7
- Top = 2400
- Width = 4815
- _ExtentX = 8493
- _ExtentY = 450
- _Version = 327682
- Appearance = 0
- End
- Begin ComctlLib.ProgressBar ProgressBarSort
- Height = 255
- Left = 1560
- TabIndex = 6
- Top = 2040
- Width = 4815
- _ExtentX = 8493
- _ExtentY = 450
- _Version = 327682
- Appearance = 0
- End
- Begin MSComDlg.CommonDialog CommonDialog1
- Left = 5040
- Top = 840
- _ExtentX = 847
- _ExtentY = 847
- _Version = 327681
- End
- Begin VB.CommandButton BtnBrowse
- Caption = "&Browse..."
- Height = 375
- Left = 5040
- TabIndex = 3
- Top = 360
- Width = 1335
- End
- Begin VB.CommandButton BtnRun
- Caption = "&Run Profile..."
- Height = 495
- Left = 240
- TabIndex = 2
- Top = 960
- Width = 1335
- End
- Begin VB.TextBox ProfileName
- Height = 375
- Left = 240
- TabIndex = 0
- Top = 360
- Width = 4695
- End
- Begin VB.Label Label3
- Caption = "Merge:"
- Height = 255
- Left = 240
- TabIndex = 5
- Top = 2400
- Width = 1095
- End
- Begin VB.Label Label1
- Caption = "Sort:"
- Height = 255
- Left = 240
- TabIndex = 4
- Top = 2040
- Width = 1215
- End
- Begin SORTSOLXLib.SortSol SortSol
- Left = 5640
- Top = 840
- _Version = 65536
- _ExtentX = 873
- _ExtentY = 873
- _StockProps = 0
- Profile = $"Main.frx":0000
- End
- Begin VB.Label Pro
- Caption = "Profile:"
- Height = 255
- Left = 240
- TabIndex = 1
- Top = 120
- Width = 3255
- End
- Attribute VB_Name = "SosoForm"
- Attribute VB_GlobalNameSpace = False
- Attribute VB_Creatable = False
- Attribute VB_PredeclaredId = True
- Attribute VB_Exposed = False
- ' Initially disable the "Run" button (no profile loaded yet!
- Private Sub Form_Load()
- BtnRun.Enabled = False
- BtnAbort.Enabled = False
- End Sub
- ' Handle the browse button to display a File Open Common Control
- Private Sub BtnBrowse_Click()
- CommonDialog1.CancelError = True
- On Error GoTo ErrHandler
- CommonDialog1.Filter = "Profiles (*.ssp)|*.ssp"
- CommonDialog1.ShowOpen
- ProfileName = CommonDialog1.filename
- Exit Sub
- ErrHandler:
- Exit Sub
- End Sub
- ' Abort the Sort
- Private Sub BtnAbort_Click()
- SortSol.Aborted = True
- End Sub
- ' Handle the "Run" button
- Private Sub BtnRun_Click()
- BtnRun.Enabled = False
- ' Handle all errors (including COM (ActiveX) errors) in one common error handler
- On Error GoTo Handler
- ' Reset the progress bars
- ProgressBarSort.Value = 0
- ProgressBarMerge.Value = 0
- ' Get the name from the edit field and load the profile
- ' This will raise an OLE error if anything goes wrong
-
- SortSol.LoadProfile (ProfileName)
- ' Allow abort
- SortSol.Aborted = False
- BtnAbort.Enabled = True
- ' Execute the sort
- ' This function will return only in case of an error
- ' or when the sort finishes
- SortSol.Sort
- ' We will only get here when no error occured
- BtnAbort.Enabled = False
- BtnRun.Enabled = True
- MsgBox "Sort completed in " & CLng(SortSol.StatsSortTime + SortSol.StatsMergeTime) & " seconds.", , "Sort Solution"
- Exit Sub
- Handler:
- ' Handle all kinds of errors with a simply message box
- ' (This is only a D E M O ...
- MsgBox SortSol.ErrorMsg, , "Error"
- ProgressBarSort.Value = 0
- ProgressBarMerge.Value = 0
- BtnAbort.Enabled = False
- BtnRun.Enabled = True
- End Sub
- ' This sub gets called when the user changes the contents
- ' of the edit field. If the field is empty, the "Run" button
- ' is disabled, else enabled
- Private Sub ProfileName_Change()
- If Len(ProfileName) > 0 Then
- BtnRun.Enabled = True
- Else
- BtnRun.Enabled = False
- End If
- End Sub
- ' This event is fired when the sort starts. Change the cursor
- ' to an hour glass to indicate the "working" mode to the user
- Private Sub SortSol_BeginSortPhase(ByVal SType As Integer)
- MousePointer = vbArrowHourglass
- End Sub
- Private Sub SortSol_FinishSortPhase()
- ' Nothing to do here
- End Sub
- Private Sub SortSol_BeginMergePhase()
- ' Nothing to do here
- End Sub
- Private Sub SortSol_FinishMergePhase()
- ' Nothing to do here
- End Sub
- Private Sub SortSol_FinishedSort()
- MousePointer = vbDefault
- End Sub
- ' The merge completed another percent
- Private Sub SortSol_MergePercentage(ByVal Percentage As Integer)
- ProgressBarMerge.Value = Percentage
- ' Keep the app responding
- DoEvents
- End Sub
- ' The sort completed another percent
- Private Sub SortSol_SortPercentage(ByVal Percentage As Integer)
- ProgressBarSort.Value = Percentage
- ' Keep the app responding
- DoEvents
- End Sub
-