Thread: How do I use Tree-View with LB_DIR(PLEASE ANSWER & READ MORE)?

  1. #1
    Programming is fun, mkay?
    Join Date
    Oct 2001
    Posts
    490

    Question How do I use Tree-View with LB_DIR(PLEASE ANSWER & READ MORE)?

    I have seen programs with dir's in a LISTBOX. I was wondering how I use Tree-View or whatever I need to use to put dir's in a listbox, and when you DBLCLK one, how do I show the contents of that directory in the LISTBOX? Then, how would I use that to move through folders?
    Website(s): http://www16.brinkster.com/trifaze/

    E-mail: [email protected]

    ---------------------------------
    C++ Environment: MSVC++ 6.0; Dev-C++ 4.0/4.1
    DirectX Version: 9.0b
    DX SDK: DirectX 8.1 SDK

  2. #2
    Registered User The15th's Avatar
    Join Date
    Aug 2001
    Posts
    125
    Hey SyntaxBubble;

    it is easy to setup a list box to read the files of a dir, the hard part is navigating through directories.

    create a listbox with WM_NOTIFY in it.

    then set the dir you want to read and the type of files to show.

    SetCurrentDirectory ("c:"); //SET dir to c:
    SendMessage (LsthWnd, LB_DIR,0x0000 , (LPARAM)"*.*") ; //disp files

    case WM_COMMAND:
    switch(HIWORD(wParam))
    {
    case LBN_DBLCLK:
    i = SendMessage (LsthWnd, LB_GETCURSEL, 0, 0); //get selected sel into i
    SendMessage (LsthWnd, LB_GETTEXT, i, (LPARAM) szBuf); //Get the text
    MessageBox(NULL,szBuf,"File Selected",NULL);//disp file name


    to navigate directories, you need to get the current directory and
    read and set the directory the user wants to navigate to. If you want i can send you my source that does this, just ask me if you want to see it.

    i hope i helped
    arrh, i got nothing good to say.
    http://www.praxis1.vic.edu.au/home/dcola/

  3. #3
    Programming is fun, mkay?
    Join Date
    Oct 2001
    Posts
    490

    Question You did help. But can I have some of ur code?

    You did help! I would also appreciate it if you would send the code.
    Website(s): http://www16.brinkster.com/trifaze/

    E-mail: [email protected]

    ---------------------------------
    C++ Environment: MSVC++ 6.0; Dev-C++ 4.0/4.1
    DirectX Version: 9.0b
    DX SDK: DirectX 8.1 SDK

  4. #4
    Registered User The15th's Avatar
    Join Date
    Aug 2001
    Posts
    125
    Here is some code. It is not my code because my code got rapidly changed to the point where it doesnt do what you want. But here is a sample program from Petzolds book. The exe is included with full source.
    arrh, i got nothing good to say.
    http://www.praxis1.vic.edu.au/home/dcola/

Popular pages Recent additions subscribe to a feed

Similar Threads

  1. bytes lost with partial read in UDP
    By mynickmynick in forum Networking/Device Communication
    Replies: 3
    Last Post: 03-31-2009, 02:06 AM
  2. "sorting news" assignment
    By prljavibluzer in forum C Programming
    Replies: 7
    Last Post: 02-06-2008, 06:45 AM
  3. Tree View Control flickering
    By cfriend in forum Windows Programming
    Replies: 1
    Last Post: 09-13-2004, 09:25 AM
  4. Request for comments
    By Prelude in forum A Brief History of Cprogramming.com
    Replies: 15
    Last Post: 01-02-2004, 10:33 AM
  5. code help :)
    By Unregistered in forum C Programming
    Replies: 4
    Last Post: 02-28-2002, 01:12 PM