Click here to Skip to main content
15,889,335 members
Home / Discussions / C / C++ / MFC
   

C / C++ / MFC

 
AnswerRe: How to hide process from being watched Pin
Programm3r24-Jul-06 0:11
Programm3r24-Jul-06 0:11 
AnswerRe: How to hide process from being watched Pin
Programm3r24-Jul-06 0:17
Programm3r24-Jul-06 0:17 
QuestionIPC -- is it reliable ??? Pin
TamirC23-Jul-06 23:53
TamirC23-Jul-06 23:53 
AnswerRe: IPC -- is it reliable ??? Pin
ThatsAlok24-Jul-06 0:02
ThatsAlok24-Jul-06 0:02 
QuestionOnKillFocus() Pin
Taruni23-Jul-06 23:26
Taruni23-Jul-06 23:26 
AnswerRe: OnKillFocus() Pin
prasad_som24-Jul-06 1:53
prasad_som24-Jul-06 1:53 
AnswerRe: OnKillFocus() Pin
David Crow24-Jul-06 3:21
David Crow24-Jul-06 3:21 
QuestionGetting folder names Pin
ashokvishnu23-Jul-06 23:26
ashokvishnu23-Jul-06 23:26 
Hi Gurus,

I want to retrieve the sub directory names from a directory. I dont want the file names if any are present. Presented below is code I am working on. However FindFileData.cFileName is giving only the first letter of the directory. How do I correct this? Since I have to use the code for productions, any corrections or better sample code will be most welcome.

void GetSubFolderNames( LPCTSTR szFolderPath )
{
WIN32_FIND_DATA FindFileData;
HANDLE hFind = INVALID_HANDLE_VALUE;
DWORD dwError;

hFind = FindFirstFile(szFolderPath, &FindFileData);

if (hFind == INVALID_HANDLE_VALUE)
{
printf ("Invalid file handle. Error is %u\n", GetLastError());
return (-1);
}
else
{
do
{
if(FindFileData.dwFileAttributes & FILE_ATTRIBUTE_DIRECTORY)
{
if ( !lstrcmp( FindFileData.cFileName, L"." )
|| !lstrcmp( FindFileData.cFileName, L".."))
{
//Do nothing for "." and ".." folders
}
else
{
CString fileName = FindFileData.cFileName;
printf ("First file name is %s\n", fileName);
}

}
} while (FindNextFile(hFind, &FindFileData) != 0) ;

dwError = GetLastError();
FindClose(hFind);
if (dwError != ERROR_NO_MORE_FILES)
{
printf ("FindNextFile error. Error is %u\n", dwError);
return (-1);
}
}
return (0);
}

Thanks

C++beginer

AnswerRe: Getting folder names Pin
Don Box23-Jul-06 23:35
Don Box23-Jul-06 23:35 
AnswerRe: Getting folder names Pin
toxcct23-Jul-06 23:46
toxcct23-Jul-06 23:46 
AnswerRe: Getting folder names Pin
ThatsAlok24-Jul-06 0:00
ThatsAlok24-Jul-06 0:00 
QuestionRe: Getting folder names Pin
David Crow24-Jul-06 3:25
David Crow24-Jul-06 3:25 
QuestionHow to create Toolbar by using resources Pin
johnalek23-Jul-06 22:41
johnalek23-Jul-06 22:41 
AnswerRe: How to create Toolbar by using resources Pin
toxcct23-Jul-06 22:54
toxcct23-Jul-06 22:54 
GeneralRe: How to create Toolbar by using resources Pin
toxcct23-Jul-06 23:00
toxcct23-Jul-06 23:00 
GeneralRe: How to create Toolbar by using resources Pin
Hamid_RT23-Jul-06 23:22
Hamid_RT23-Jul-06 23:22 
GeneralRe: How to create Toolbar by using resources Pin
toxcct23-Jul-06 23:24
toxcct23-Jul-06 23:24 
GeneralRe: How to create Toolbar by using resources Pin
Hamid_RT23-Jul-06 23:41
Hamid_RT23-Jul-06 23:41 
GeneralRe: How to create Toolbar by using resources Pin
ThatsAlok24-Jul-06 0:02
ThatsAlok24-Jul-06 0:02 
GeneralRe: How to create Toolbar by using resources Pin
toxcct24-Jul-06 0:13
toxcct24-Jul-06 0:13 
GeneralRe: How to create Toolbar by using resources Pin
ThatsAlok24-Jul-06 0:19
ThatsAlok24-Jul-06 0:19 
AnswerRe: How to create Toolbar by using resources Pin
Hamid_RT23-Jul-06 23:05
Hamid_RT23-Jul-06 23:05 
QuestionHow to create a Property Sheet Application Pin
ashwath200523-Jul-06 21:28
ashwath200523-Jul-06 21:28 
AnswerRe: How to create a Property Sheet Application Pin
Naveen23-Jul-06 21:36
Naveen23-Jul-06 21:36 
GeneralRe: How to create a Property Sheet Application Pin
ashwath200524-Jul-06 1:11
ashwath200524-Jul-06 1:11 

General General    News News    Suggestion Suggestion    Question Question    Bug Bug    Answer Answer    Joke Joke    Praise Praise    Rant Rant    Admin Admin   

Use Ctrl+Left/Right to switch messages, Ctrl+Up/Down to switch threads, Ctrl+Shift+Left/Right to switch pages.