15 мая 2023 года "Исходники.РУ" отмечают своё 23-летие!
Поздравляем всех причастных и неравнодушных с этим событием!
И огромное спасибо всем, кто был и остаётся с нами все эти годы!

Главная Форум Журнал Wiki DRKB Discuz!ML Помощь проекту


Long Filenames using CListBox::Dir()

Keith Y. Higaki -- khigaki@aloha.net
Monday, January 22, 1996

Is it possible to use the CListBox::Dir() function to insert long
filenames into a listbox? Here's a clipping of my code:

	// in .H file
	CListBox m_ListBox;

	// in .CPP file
	int nCount = m_ListBox.Dir(0x4010, DEF_EXT);

The problem is that all file names appears in the DOS 8.3 format or
the abbreviated    format.

Thank you ahead for any help that is provided.

**************************
Keith Y. Higaki
CompuServe: 75021,3701
E-mail: khigaki@aloha.net
**************************




Marty Fried -- mfried@linex.com
Wednesday, January 24, 1996

[Mini-digest: 2 responses]

At 04:43 PM 1/22/96 -1000, Keith Y. Higaki wrote:
>Is it possible to use the CListBox::Dir() function to insert long
>filenames into a listbox? Here's a clipping of my code:
> . . .
>The problem is that all file names appears in the DOS 8.3 format or
>the abbreviated    format.

That is my experience, too.  I believe this is a limitation of the
system listbox calls, which the class wraps. 

 -+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-
 Marty Fried (mfried@linex.com)
 Marin County, California

-----From: "Mike Blaszczak" 

Keith Y. Higaki wrote:

> The problem is that all file names appears in the DOS 8.3 format or
> the abbreviated    format.

You don't mention which version of Windows you're using.

Please read Knowledge-Base article Q131286.  If you have VC++ 4.0, you would 
have seen this article if you searched books online for "LB_DIR".

If you use Spy++, can you notice any difference between the styles of a dialog 
box and/or a listbox in the system which works (for example, in Notepad) and 
the list box and dialog box you're using?

.B ekiM
TCHAR szDisc[] = _T("These words are my own; I do not speak for Fabio.");



Keith Y. Higaki -- khigaki@aloha.net
Saturday, January 27, 1996

Here's a solution that has worked for me using Windows 95 and VC++ 4.0:

#define DEF_EXT		"*.txt"
#define GLOBAL_EXT	"*.*"

CString szPath;
WIN32_FIND_DATA wfd;
HANDLE hFindHandle;
// NOTE: m_ListBox is my dialog's ListBox member

// Get the Directories
hFindHandle = FindFirstFile(GLOBAL_EXT, &wfd);
if(hFindHandle != INVALID_HANDLE_VALUE) {
	if(wfd.dwFileAttributes & FILE_ATTRIBUTE_DIRECTORY) {
		szPath.Format("%c%s%c", '[', wfd.cFileName, ']');
		m_ListBox.AddString(szPath);
	}
	while(FindNextFile(hFindHandle, &wfd)) {
		if(wfd.dwFileAttributes & FILE_ATTRIBUTE_DIRECTORY) {
			szPath.Format("%c%s%c", '[', wfd.cFileName, ']');
			m_ListBox.AddString(szPath);
		}
	}
}
FindClose(hFindHandle);

// Get the Filenames
hFindHandle = FindFirstFile(DEF_EXT, &wfd);
if(hFindHandle != INVALID_HANDLE_VALUE) {
	szPath = wfd.cFileName;
	m_ListBox.AddString(szPath);
	while(FindNextFile(hFindHandle, &wfd)) {
		szPath = wfd.cFileName;
		m_ListBox.AddString(szPath);
	}
}
FindClose(hFindHandle);

// Get Drives
m_ListBoxFrom.Dir(0xC000, GLOBAL_EXT);




At 09:56 PM 1/24/96 -0800, you wrote:
>[Mini-digest: 2 responses]
>
>At 04:43 PM 1/22/96 -1000, Keith Y. Higaki wrote:
>>Is it possible to use the CListBox::Dir() function to insert long
>>filenames into a listbox? Here's a clipping of my code:
>> . . .
>>The problem is that all file names appears in the DOS 8.3 format or
>>the abbreviated    format.
>
>That is my experience, too.  I believe this is a limitation of the
>system listbox calls, which the class wraps. 
>
> -+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-
> Marty Fried (mfried@linex.com)
> Marin County, California
>
>-----From: "Mike Blaszczak" 
>
>Keith Y. Higaki wrote:
>
>> The problem is that all file names appears in the DOS 8.3 format or
>> the abbreviated    format.
>
>You don't mention which version of Windows you're using.
>
>Please read Knowledge-Base article Q131286.  If you have VC++ 4.0, you would 
>have seen this article if you searched books online for "LB_DIR".
>
>If you use Spy++, can you notice any difference between the styles of a dialog 
>box and/or a listbox in the system which works (for example, in Notepad) and 
>the list box and dialog box you're using?
>
>.B ekiM
>TCHAR szDisc[] = _T("These words are my own; I do not speak for Fabio.");
>
>

**************************************************
Keith Y. Higaki
H&H Enterprises
45-1133 Makamae Street
Kaneohe, HI 96744-3122

Telephone:  808-235-0109
CompuServe: 75021,3701
E-mail:     khigaki@aloha.net
WWW URL:    http://hookomo.aloha.net/~khigaki/
**************************************************





| Вернуться в корень Архива |