Thread: Displaying disk contents in window

  1. #1
    HisWord
    Guest

    Question Displaying disk contents in window

    Hey guys. I'm starting to progress in my programming skills and am ready for something new. I recently made a simple FTP program and it works great, but now I think I want to make my own FTP browser. My question is: How does one go about listing the contents of a directory in a control? I want it to look just like the window file explorer. Can this be done with just API or must I use MFC?

  2. #2
    pronounced 'fib' FillYourBrain's Avatar
    Join Date
    Aug 2002
    Posts
    2,297
    of course it can be done. There may be a control you can load that supports icons and such but I'm not really familiar with it. certainly you could just draw them yourself. Get a series of folder and file icons, stick them in your project's resources. When you get your listing of files to display, blit the images to an appropriate place, output whatever text you need to right below it. Like I said, there may already be a common control for this but you don't have to have one.

    As far as MFC goes, anything you are doing in MFC can be done in the API. There's nothing magical about MFC. It's a wrapper.
    "You are stupid! You are stupid! Oh, and don't forget, you are STUPID!" - Dexter

  3. #3
    &TH of undefined behavior Fordy's Avatar
    Join Date
    Aug 2001
    Posts
    5,793
    GetOpenFileName() (the standard open file dialog) can be configured to allow you to select more than 1 file at a time, and I think you can use a custom dialog for it....

    See MSDN if you want to see more on this func and its implementation

  4. #4
    erstwhile
    Join Date
    Jan 2002
    Posts
    2,227
    If you mean 'looks like explorer.exe' then you need to look into common controls. The left pane in explorer is a 'treeview' control while the right-most pane is a listview control. If you want the same splitter-bar functionality for resizing these panes then you will have to build that into your app eg. by creating a custom control to do it as there is no splitter window control currently defined by the system.
    CProgramming FAQ
    Caution: this person may be a carrier of the misinformation virus.

  5. #5
    It's full of stars adrianxw's Avatar
    Join Date
    Aug 2001
    Posts
    4,829
    >>> Can this be done with just API or must I use MFC?

    MFC is a wrapper around Win32. Thus, Anything you can do with MFC, you can do with the raw API. MFC is simply a class library, (there are others), that encapsulates some of the basic API.
    Wave upon wave of demented avengers march cheerfully out of obscurity unto the dream.

  6. #6
    HisWord
    Guest

    Talking

    Once again you've been so very helpful, unlike some other placesI' tried to get help. I will start looking into these controls.

  7. #7
    train spotter
    Join Date
    Aug 2001
    Location
    near a computer
    Posts
    3,868
    Also for a simple list of files, try a Listbox and send it a LB_DIR msg.

    As to the Treeview and Listview, FindFirstFile(), FindNextFile() and FindClose() may also be helpful to get the files.
    "Man alone suffers so excruciatingly in the world that he was compelled to invent laughter."
    Friedrich Nietzsche

    "I spent a lot of my money on booze, birds and fast cars......the rest I squandered."
    George Best

    "If you are going through hell....keep going."
    Winston Churchill

Popular pages Recent additions subscribe to a feed

Similar Threads

  1. Adding buttons, edit boxes, etc to the window
    By rainmanddw in forum Windows Programming
    Replies: 1
    Last Post: 04-10-2006, 03:07 PM
  2. My Window Class
    By Epo in forum Game Programming
    Replies: 2
    Last Post: 07-10-2005, 02:33 PM
  3. my wndProc is out of scope
    By Raison in forum Windows Programming
    Replies: 35
    Last Post: 06-25-2004, 07:23 AM
  4. dont want to use all params
    By stallion in forum Windows Programming
    Replies: 2
    Last Post: 02-18-2003, 08:10 AM
  5. Invoking MSWord
    By Donn in forum C Programming
    Replies: 21
    Last Post: 09-08-2001, 04:08 PM