CodeGuru Home VC++ / MFC / C++ .NET / C# Visual Basic VB Forums Developer.com
Results 1 to 2 of 2
  1. #1
    Join Date
    Nov 1999
    Location
    Austria
    Posts
    56

    directory reading

    I need in an elder project (developed under VCC 1.5 I can t change it for some dll reasons)the content of an directory

    CListBox ListBox;
    LPSTR Path;
    int Zero;
    CString DirName;
    Path = "C:\\TRANSFER\\*.*";
    UINT attr = 0x0000;

    ListBox.Dir(attr,Path);

    Zero = ListBox.GetCount();

    But I got always zero so where is the bug??
    Any help is welcomed
    Long



  2. #2
    Join Date
    Aug 2000
    Location
    Germany
    Posts
    112

    Re: directory reading

    Hi Long !

    Is there a Listbox in a Dialog where your CListBox belongs to if not if won't work i think.
    If i don't have i get a assertion (VC 6). I'm not sure what VC 1.5 does.
    The following works for me :


    TestDlg::OnInitDialog()
    {
    CDialog::OnInitDialog();
    CListBox* ListBox;
    ListBox=(CListBox*)GetDlgItem(IDC_LIST1);
    LPSTR Path;
    int Zero;
    CString DirName;
    Path = "C:\\*.*";
    UINT attr = 0x0000;

    ListBox->Dir(attr,Path);
    Zero = ListBox->GetCount();




    The Dialog has a Listbox IDC_LIST1 must not be visible if not needed.
    Zero returns the numbers of Files not 0;

    HtH
    Stiewie


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

Featured