I downloaded this program, and it works fine like it is.
I then made an application using the wizard in VB5 that
looks like Explorer.
I pasted all of whats in the downloaded program into
the proper places(I'm pretty sure), but when I try to
run the program, I get an error:
(ImageList must be intialized before it can be used)
Do I really have to put in more code to intialize it?
Why does it work in the original like it is?
What I'm trying to do is make a program just like explorerCode:Option Explicit ' How to... ' by Philippe Durand Private Sub DirFolders_Change() filFiles.Path = DirFolders.Path End Sub Private Sub driDrives_Change() DirFolders.Path = driDrives.Path End Sub Private Sub Form_Load() Call BuildDriveList End Sub Private Sub BuildDriveList() Dim i As Integer Dim strPath As String Dim intIcon As Integer tvwDirectory.Nodes.Clear For i = 0 To driDrives.ListCount - 1 strPath = UCase(Left(driDrives.List(i), 1)) & ":\" Select Case strPath Case "A:\", "B:\" ' Diskette drive. intIcon = 1 Case "D:\" intIcon = 3 ' CD drive. Case Else ' Hard drive. intIcon = 2 End Select tvwDirectory.Nodes.Add , , strPath, driDrives.List(i), intIcon tvwDirectory.Nodes.Add strPath, tvwChild, "" Next End Sub Private Sub tvwDirectory_Expand(ByVal Node As ComctlLib.Node) On Error GoTo ErrorTrapping Dim i As Integer Dim strRelative As String Dim strFolderName As String Dim intFolderPos As Integer Dim intIcon As Integer Dim strNewPath As String Dim strExt As String Dim intExtPos As Integer MousePointer = vbHourglass If Node.Child.Text = "" Then tvwDirectory.Nodes.Remove Node.Child.Index strRelative = Node.Key DirFolders.Path = strRelative intFolderPos = Len(strRelative) + 1 ' Add folders For i = 0 To DirFolders.ListCount - 1 strFolderName = Mid(DirFolders.List(i), intFolderPos) strNewPath = strRelative & strFolderName & "\" tvwDirectory.Nodes.Add strRelative, tvwChild, strNewPath, strFolderName, 4 DirFolders.Path = strNewPath If (filFiles.ListCount > 0) Or (DirFolders.ListCount > 0) Then tvwDirectory.Nodes.Add strNewPath, tvwChild, , "" tvwDirectory.Nodes(strNewPath).ExpandedImage = 5 End If DirFolders.Path = strRelative Next ' Add files For i = 0 To filFiles.ListCount - 1 strExt = UCase(filFiles.List(i)) intExtPos = InStr(strExt, ".") + 1 If intExtPos > 0 Then strExt = Mid(strExt, intExtPos) Else strExt = "" End If Select Case strExt Case "TXT", "DOC" intIcon = 9 Case "HLP" intIcon = 8 Case "EXE", "COM" intIcon = 7 Case "BMP", "JPG", "GIF" intIcon = 6 Case Else intIcon = 10 End Select tvwDirectory.Nodes.Add strRelative, tvwChild, , filFiles.List(i), intIcon Next End If GoTo EndSub ErrorTrapping: ' An error occurs when you try reading on a not ready drive ' re-add the precedent removed item tvwDirectory.Nodes.Add Node.Key, tvwChild, , "" Resume EndSub EndSub: MousePointer = vbDefault End Sub
except were you can add notes out beside modified column on
the right side.




Reply With Quote