Results 1 to 3 of 3

Thread: Form will not show until sub has completed. [SOLVED]

Threaded View

  1. #1

    Thread Starter
    Fanatic Member hothead's Avatar
    Join Date
    Mar 2002
    Location
    Missouri
    Posts
    692

    Form will not show until sub has completed. [SOLVED]

    Ok, got rid of all the headaches in the search algorithm I used, it shows the startup form, but I have another form with a progress bar on it, and that won't show until the algorithm has completed its routine.

    VB Code:
    1. Sub ScanFolder(FolderSpec)
    2.     Dim thisFolder As Folder
    3.     Dim allFolders As Folders
    4.     Dim thisFile As File
    5.     Dim allFiles As Files
    6.     Dim lstItem As ListItem
    7.     Set fso = New FileSystemObject
    8.     If Not FolderSpec = "D" Then
    9.         Set thisFolder = fso.GetFolder(FolderSpec & "\")
    10.     Else
    11.         Set thisFolder = fso.GetFolder(FolderSpec & ":")
    12.     End If
    13.     Set allFolders = thisFolder.SubFolders
    14.     For Each thisFolder In allFolders
    15.         Set allFiles = thisFolder.Files
    16.         If allFiles.Count > 0 Then
    17.             For Each thisFile In allFiles
    18.                 Set lstItem = frmMain.lvwVolumes.ListItems.Add(, , thisFile.Name)
    19.                 lstItem.SubItems(1) = thisFile.Size
    20.             Next
    21.         End If
    22.         Set allFiles = Nothing
    23.         ScanFolder thisFolder.Path
    24.         DoEvents
    25.     Next
    26.     Set thisFolder = Nothing
    27.     Set allFolders = Nothing
    28.     Set rs = Nothing
    29.     Set fso = Nothing
    30.     Exit Sub
    31. End Sub

    And here's where I call the form.

    VB Code:
    1. Sub ProcessDeviceChange(wParam As Long, lParam As Long)
    2.     Dim DBHdr As DEV_BROADCAST_HDR
    3.     Dim DBVol As DEV_BROADCAST_VOLUME
    4.     CopyMemory DBHdr, ByVal lParam, LenB(DBHdr)
    5.     If wParam = DBT_DEVICEARRIVAL Then
    6.         If DBHdr.dbch_devicetype = DBT_DEVTYP_VOLUME Then
    7.             CopyMemory DBVol, ByVal lParam, LenB(DBVol)
    8.             If (DBVol.dbcv_flags And DBTF_MEDIA) = DBTF_MEDIA Then
    9.                 frmSetup.Show
    10.             End If
    11.         End If
    12.     End If
    13. End Sub
    Last edited by hothead; Apr 30th, 2004 at 06:23 PM.

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  



Click Here to Expand Forum to Full Width