Results 1 to 3 of 3

Thread: drivelistbox?

  1. #1

    Thread Starter
    Hyperactive Member MPrestonf12's Avatar
    Join Date
    Jun 1999
    Location
    NY
    Posts
    330

    drivelistbox?

    How would I go about creating a list box that contains all the drives on the computer?
    Matt

  2. #2
    Junior Member
    Join Date
    Jun 2001
    Posts
    22
    asssuming you know how to create a listbox, call
    Code:
    int DlgDirList(
      HWND hDlg,          // handle to dialog box with list box
      LPTSTR lpPathSpec,  // path or file name buffer
      int nIDListBox,     // list box identifier
      int nIDStaticPath,  // static control identifier
      UINT uFileType      // file attributes to display
    );
    According to MSDN, the parameters are:
    Code:
    Parameters
    hDlg 
    [in] Handle to the dialog box that contains the list box. 
    ---
    lpPathSpec 
    [in/out] Pointer to a buffer containing a null-terminated string that specifies an absolute path, relative path, or filename. An absolute path can begin with a drive letter (for example, d:\) or a UNC name (for example, \\machinename\sharename). 
    The function splits the string into a directory and a filename. The function searches the directory for names that match the filename. If the string does not specify a directory, the function searches the current directory. 
    
    If the string includes a filename, the filename must contain at least one wildcard character (? or *). If the string does not include a filename, the function behaves as if you had specified the asterisk wildcard character (*) as the filename. All names in the specified directory that match the filename and have the attributes specified by the uFileType parameter are added to the list box. 
    
    nIDListBox 
    [in] Specifies the identifier of a list box in the hDlg dialog box. If this parameter is zero, DlgDirList does not try to fill a list box. 
    ---
    nIDStaticPath 
    [in] Specifies the identifier of a static control in the hDlg dialog box. DlgDirList sets the text of this control to display the current drive and directory. This parameter can be zero if you do not want to display the current drive and directory. 
    ---
    uFileType 
    [in] Specifies the attributes of the files or directories to be added to the list box. This parameter can be one or more of the following values. Value Description 
    DDL_ARCHIVE Includes archived files. 
    DDL_DIRECTORY Includes subdirectories. Subdirectory names are enclosed in square brackets ([ ]). 
    DDL_DRIVES All mapped drives are added to the list. Drives are listed in the form [-x-], where x is the drive letter. 
    DDL_EXCLUSIVE Includes only files with the specified attributes. By default, read-write files are listed even if DDL_READWRITE is not specified. 
    DDL_HIDDEN Includes hidden files. 
    DDL_READONLY Includes read-only files. 
    DDL_READWRITE Includes read-write files with no additional attributes. This is the default setting. 
    DDL_SYSTEM Includes system files. 
    DDL_POSTMSGS If set, DlgDirList uses the PostMessage function to send messages to the list box. If not set, DlgDirList uses the SendMessage function.

  3. #3

    Thread Starter
    Hyperactive Member MPrestonf12's Avatar
    Join Date
    Jun 1999
    Location
    NY
    Posts
    330
    Its directly on the window I created im not using dialog boxes. For the first parameter would I pass, the handle to the listbox or handle to window?
    thanks for your help.
    Matt

Posting Permissions

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



Click Here to Expand Forum to Full Width