Results 1 to 3 of 3

Thread: VB6 Folks.. Perhaps a little help

  1. #1
    Constant Bitrate
    Join Date
    Sep 2004
    Location
    Frisco, Texas
    Posts
    190

    VB6 Folks.. Perhaps a little help

    Okay. Im taking a crack at my own player. I'm a decently experienced coder, but I'm stumped. Perhaps I am too close to the problem to see clearly.

    Anyway, I'm working on an idea to use a TreeView control to explore directory structure and MP3 in the same window. Idea is to work with TreeView with checkboxes, so I can check songs and whole directories and for example add them all to a playlist, queue, etc.

    I've tried numerous TreeView Controls. Current control is from VBAccellerator.


    Code:
    Option Explicit
    
    Private m_cIml As New cVBALSysImageList
    Private m_lID As Long
    Private m_shl As New Shell
    
    Private Sub Form_Load()
       ' Create a System Image List:
       Set m_cIml = New cVBALSysImageList
       m_cIml.IconSizeX = 16
       m_cIml.IconSizeY = 16
       m_cIml.Create
       tvwDirs.ImageList = m_cIml.hIml
    
       ' Enumerate the shell's desktop folder for files
       Dim drives As Folder
       Set drives = m_shl.NameSpace("E:\ripped")
       Dim driveItem As FolderItem
       Dim nod As cTreeViewNode
       Dim count As Long
       Dim sKey As String
       For Each driveItem In drives.items
          If (driveItem.IsFolder) Then
            
             m_lID = m_lID + 1
             sKey = m_lID & ":" & driveItem.Path
             Set nod = tvwDirs.nodes.Add(, , sKey, driveItem.Name, _
                m_cIml.ItemIndex(driveItem.Path, True))
              
             nod.ItemData = 0
             
             m_lID = m_lID + 1
             nod.Children.Add , , "TODO:" & m_lID, "Unexpanded"
          Else
             m_lID = m_lID + 1
             sKey = m_lID & ":" & driveItem.Path
             Set nod = tvwDirs.nodes.Add(, , sKey, driveItem.Name, _
                m_cIml.ItemIndex(driveItem.Path, True))
             nod.ItemData = 1
          End If
       Next
    
    End Sub
    
    
    
    Private Sub tvwDirs_BeforeExpand(node As vbalTreeViewLib6.cTreeViewNode, cancel As Boolean)
       
       If InStr(node.FirstChild.Key, "TODO:") = 1 Then
          
          Screen.MousePointer = vbHourglass
          
          node.Children.Remove 1
          
    
          Dim items As Folder
          Dim itm As FolderItem
          Dim nod As cTreeViewNode
          Dim sKey As String
          Dim iPos As Long
          Dim nodes As cTreeViewNodes
          Set nodes = node.Children
          
          sKey = node.Key
          iPos = InStr(sKey, ":")
          sKey = Mid(sKey, iPos + 1)
          Set items = m_shl.NameSpace(sKey)
          If Not items Is Nothing Then
             For Each itm In items.items
                If (itm.IsFolder) Then
                   m_lID = m_lID + 1
                   sKey = m_lID & ":" & itm.Path
                   Set nod = nodes.Add(, , sKey, itm.Name, _
                   m_cIml.ItemIndex(itm.Path, True))
                   nod.ItemData = 0
                   m_lID = m_lID + 1
                   nod.Children.Add , , "TODO:" & m_lID, "Unexpanded"
                Else
                   m_lID = m_lID + 1
                   sKey = m_lID & ":" & itm.Path
                   Set nod = nodes.Add(, , sKey, itm.Name, _
                      m_cIml.ItemIndex(itm.Path, True))
                   nod.ItemData = 1
                End If
             Next
          End If
          
          node.Sort etvwItemDataThenAlphabetic
          
          Screen.MousePointer = vbDefault
          
       End If
       
    End Sub
    This should loop and display the subfolders of the base directory on FormLoad.. and it does.

    On Expand of Tree tvwDirs_BeforeExpand should then loop and display subfolders of current node on each expand. and it does not.

    I have no doubt it is a silly syntax issue, but I can't find it.

    Thanks in advance for any help.

    Jack

  2. #2
    FLAC IntellaWorks's Avatar
    Join Date
    Jun 2004
    Location
    NH
    Posts
    1,173

    .

    wut about writing your own active x.. makes more sense... instead of trying to shape something...
    Progress [I will seriously never be done!]
    Via EPIA MII
    512MB RAM
    OEM GPS (embedded)
    nLite WinXP pro on
    1GB Extreme III CF card
    Carnetix 1260 startup/ DC-DC regulator
    Software: Still, re-Writing my existing front end in .Net

  3. #3
    Constant Bitrate
    Join Date
    Sep 2004
    Location
    Frisco, Texas
    Posts
    190
    Most likely beyond my current abilities. This should be an easy thing call Shell for base directory, load directories in tree. On each expand, call Shell again and load subdirectories and/or files.

Similar Threads

  1. Yet Another OBDII VB6 Class
    By Erorus in forum Engine Management, OBD-II, Engine Diagnostics, etc.
    Replies: 33
    Last Post: 07-02-2008, 09:58 PM
  2. Embedding a window in VB6 - Help
    By pioneer in forum Software & Software Development
    Replies: 9
    Last Post: 06-22-2004, 05:25 PM
  3. Embedding apps in vb6
    By Laidback in forum Software & Software Development
    Replies: 9
    Last Post: 05-09-2004, 08:44 PM
  4. Folks With Inverters - Switching On PC?
    By Max018 in forum General Hardware Discussion
    Replies: 8
    Last Post: 02-21-2004, 12:25 AM
  5. Screwy docked toolbox in VB6!!
    By deadweasel in forum Software & Software Development
    Replies: 5
    Last Post: 02-12-2004, 03:06 AM

Bookmarks

Posting Permissions

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