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:
Sub ScanFolder(FolderSpec) Dim thisFolder As Folder Dim allFolders As Folders Dim thisFile As File Dim allFiles As Files Dim lstItem As ListItem Set fso = New FileSystemObject If Not FolderSpec = "D" Then Set thisFolder = fso.GetFolder(FolderSpec & "\") Else Set thisFolder = fso.GetFolder(FolderSpec & ":") End If Set allFolders = thisFolder.SubFolders For Each thisFolder In allFolders Set allFiles = thisFolder.Files If allFiles.Count > 0 Then For Each thisFile In allFiles Set lstItem = frmMain.lvwVolumes.ListItems.Add(, , thisFile.Name) lstItem.SubItems(1) = thisFile.Size Next End If Set allFiles = Nothing ScanFolder thisFolder.Path DoEvents Next Set thisFolder = Nothing Set allFolders = Nothing Set rs = Nothing Set fso = Nothing Exit Sub End Sub
And here's where I call the form.
VB Code:
Sub ProcessDeviceChange(wParam As Long, lParam As Long) Dim DBHdr As DEV_BROADCAST_HDR Dim DBVol As DEV_BROADCAST_VOLUME CopyMemory DBHdr, ByVal lParam, LenB(DBHdr) If wParam = DBT_DEVICEARRIVAL Then If DBHdr.dbch_devicetype = DBT_DEVTYP_VOLUME Then CopyMemory DBVol, ByVal lParam, LenB(DBVol) If (DBVol.dbcv_flags And DBTF_MEDIA) = DBTF_MEDIA Then frmSetup.Show End If End If End If End Sub




Reply With Quote