Announcement

Collapse
No announcement yet.

FileNames (directory listing) in listbox

Collapse
X
 
  • Filter
  • Time
  • Show
Clear All
new posts

  • Egbert Zijlema
    replied
    Thanks again, Lance.

    You've told me that already via ANOTHER thread in this forum. It works fine.
    Later on I found %LB_DIR message and the related 8.3-problem and a question on that subject did me start THIS thread.


    ------------------
    mailto:[email protected][email protected]</A>
    www.basicguru.com/zijlema/

    Leave a comment:


  • Lance Edmonds
    replied
    To extend Steve's reply slightly... if you wish to minimize the "flicker" during the update of the listbox (and probably speed it up too) while sending the individual strings to the listbox, you should set the %WM_SETREDRAW state of the listbox to %FALSE before sending the strings, and restore the redraw state back to %TRUE afterward.




    ------------------
    Lance
    PowerBASIC Support
    mailto:[email protected][email protected]</A>

    Leave a comment:


  • Steve Hutchesson
    replied
    Egbert,

    Unless you have a reason to use a string array apart from the
    list box, there is no point doing it that way, you can just
    loop through the FindFirst/FindNext APIs and load each name
    into the listbox as its found, saves doing 2 operations. There
    is a SendMessage for doing just that and you can load zero
    terminated strings with no problems.

    Regards,

    [email protected]

    ------------------

    Leave a comment:


  • Egbert Zijlema
    replied
    Fred,

    I found that too, later on. Because I'm not permanently on line, I use Win32.HLP, but the version I have does not report the 8.3 issue.
    What MSDN says about using GetFullPathName etc. does no really comfort me, for 2 reasons:
    1. it does not work under W95, as far as I know
    2. it makes the routine too complicated. Then better and easier create a string array of your own, using Findfirst/Findnext.

    ------------------
    mailto:[email protected][email protected]</A>
    www.basicguru.com/zijlema/

    Leave a comment:


  • Fred Oxenby
    replied
    quote from MSDN
    Windows NT/2000: (NT3.1/NT4/Win2000) The list displays long filenames, if any.
    Windows 95: The list displays short filenames (the 8.3 form). You can use the SHGetFileInfo or GetFullPathName functions to get the corresponding long filename.

    ------------------
    Fred
    mailto:[email protected][email protected]</A>
    http://www.oxenby.se



    [This message has been edited by Fred Oxenby (edited February 18, 2001).]

    Leave a comment:


  • Steve Hutchesson
    replied
    Egbert,

    Thats normal, I think the only way you can fill a list box with
    long file names is to read them manually and add them to the list.

    Regards,

    [email protected]

    ------------------

    Leave a comment:


  • Egbert Zijlema
    started a topic FileNames (directory listing) in listbox

    FileNames (directory listing) in listbox

    Hi fellows,

    There are 2 possibilities to fill a listbox with an array of file names or directory list. The first method is to collect the file names in a (Power) Basic array, using FindFirst/FindNext, and then pass the array's name through the CONTROL ADD LISTBOX command.
    An alternative is to send the %LB_DIR message to the control, using wParam (if necessary) for file attributes and lParam for a pointer to the directory. In this case the listbox takes care of the collect job. This seems to be the right format:
    Code:
    dirmask$ = DirectoryPathName + "\*.*"
    CONTROL SEND CBHNDL, %IDLISTBOX, %LB_DIR, 0, STRPTR(dirmask$)
    When using this method, however, long filenames show up in 8.3 notation, abbreviated by the tilde character. Is this normal, or am I doing something wrong, as usual.

    ------------------
    mailto:[email protected][email protected]</A>
    www.basicguru.com/zijlema/
Working...
X
😀
🥰
🤢
😎
😡
👍
👎