No announcement yet.


  • Filter
  • Time
  • Show
Clear All
new posts

  • Icons


    Do you know how i can get the correct icon of directories and the corect icons of drives with PowerBasic, code ?

    I will create a TreeView like Explorer, but i don´t know how i can get the
    icons for drives and folder...

    Help me please..

  • #2
    Yup, use #4 and 5 from SHELL32.DLL
    Global hFolderIcon as long

    local z as Asciiz * 255
    Local hLib as long

    z = "SHELL32.DLL"
    hLib = LoadLibrary(z)
    If hLib Then
    hFolderIcon = LoadCursor(hLib, ByVal 4) 'Closed, use 5 for Open folder
    FreeLibrary hLib
    End If


    [This message has been edited by Scott Turchin (edited February 09, 2000).]
    Scott Turchin
    True Karate-do is this: that in daily life, one's mind and body be trained and developed in a spirit of humility; and that in critical times, one be devoted utterly to the cause of justice. -Gichin Funakoshi


    • #3
      Or you can get the whole image list...

      ' Get the handle to the system's small icon imagelist and assign it to the
      ' TreeView. We will set the Node image indices directly in InsertFolder.
      Call TreeView_SetImageList(hwndTV, GetSystemImagelist(%SHGFI_SMALLICON), %TVSIL_NORMAL)
      Regards, Jules



      • #4
        Sorry Folks! Once again, I supplied invalid information. The
        call above is not an API call! It is a user defined function
        that was included with a Visual Basic example. Funny nobody
        questioned it.

        One comment about Scotts method, it would be possible to get
        different Icons if future DLL's shuffled the Icons around. It
        would be better to use an Icon extractor to get your Drive/folder Icons and then put them in your resource file. I
        pulled out about 1000 Icons from Shell32.DLL. Icons 4 and 5 are
        the larger Icons. You probably want the smaller ones if you are
        building an Explorer type program.

        Johan, I am converting some C code that is like the Explorer. But
        I don't have any real directory tree, just dummy sample tree.

        Have you completed this task yet?

        Regards, Jules
        mailto:[email protected][email protected]</A>