|
-
March 6th, 2001, 03:04 AM
#1
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
-
March 6th, 2001, 11:46 AM
#2
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
-
Forum Rules
|
Click Here to Expand Forum to Full Width
|