|
WIN32_FIND_DATA fd = { 0 };
HANDLE hFind = FindFirstFile( filespec, &fd );
if ( hFile != NULL )
{
do
{
}
while( FindNextFile( hFind, &fd ) );
CloseHandle( hFind );
} Note that filespec should contain wildcards (e.g. "C:\\Windows\\*") if you want multiple files to match.
Stability. What an interesting concept. -- Chris Maunder
|
|
|
|
|
You'll miss the last file and you won't properly read the first one with the above example.
WIN32_FIND_DATA fd = { 0 };
HANDLE hFind = FindFirstFile( filespec, &fd );
if ( hFile != NULL )
{
BOOL MoreFilesFollow;
do
{
MoreFilesFollow = FindNextFile( hFind, &fd );
}
while(MoreFilesFollow);
CloseHandle( hFind );
}
|
|
|
|
|
hmm
i tried the code from the msdn documentation
and a code (which looks like yours and the same from msdn) from a website
the website code works, msdn not, but all look very similar
thx@ll
|
|
|
|
|
Brad, I'm sorry, you're wrong. After FindFirstFile returns successfully, fd contains the attributes of the first file that matches the file specification. FindNextFile returns non-zero until it has returned all the files unless some other error occurs. You can find out why it returned FALSE by checking GetLastError . If no more files were found the last error code is ERROR_NO_MORE_FILES .
Your code will skip the first file and process the last file twice.
My code is derived from many working programs, which have been well tested and deployed in production.
My experience is that FindFirstFile appears to perform a capture operation - it actually finds all the matching files and stores them in an in-memory structure. FindNextFile then hands out the next entry in that structure until it runs out. The effect of this is that any files added to or deleted from the folder after FindFirstFile is called will not be found (or will be found, if deleted).
Stability. What an interesting concept. -- Chris Maunder
|
|
|
|
|
!@#$!@#$ CFileFind
They just can't make a class accurately reflect the underlying API can they?
|
|
|
|
|
I've been writing some code to write audio tracks to a CD using IMAPI. This works fine except Windows Media Player tries to determine the Album name and artist and gets it completely wrong.
Is there anyway of writing the artist / album / track info to the CD?
Where does Media Player store its cache of album info?
How is the album info stored on the CD and is there any utility that will extract the info?
|
|
|
|
|
The feature is called CD Text, but take care: it is not supported by older cd drives.
An alternative is CDDB, but I don't know exactly how it works. It does read some identification code from the cd and uses webservers to get the track list.
Don't try it, just do it!
|
|
|
|
|
the artist info and track info are not stored on the CD, and that's shame if you ask me.
the only thing that is stored, is a CD ID; once retrieved, your software must search the web for the artist and track info on sites like cddb.com ( or the free one but I can't remember the name ); I think those sites offers SDK to use their service.
Maximilien Lincourt
Your Head A Splode - Strong Bad
|
|
|
|
|
How do you set the CD ID? I can't see anything from IMAPI.
Is it a value in the cda file?
|
|
|
|
|
I took a quick look through the IMAPI docs but I didn't see anything about support for CD Text.
CDDB doesn't use any metadata on the CD. All that is is the client taking a hash of the number of tracks + their lengths, and doing a database lookup for CDs whose contents have the same hash.
--Mike--
Visual C++ MVP
LINKS~! Ericahist | 1ClickPicGrabber | CP SearchBar v2.0.2 | C++ Forum FAQ
Strange things are afoot at the U+004B U+20DD
|
|
|
|
|
Hi there,
I'm looking for a C++ or .NET class library to create a surface or 3D graph.
Thanks.
|
|
|
|
|
I think this will help u....
http://sharptoolbox.com/Categorybf83036c-33f4-429e-b6c3-bdca40021dd5.aspx
****************************************************************************
http://www.dotnet247.com/247reference/msgs/40/203674.aspx
keep smilling.....b'coz smile is the shortest distance between people....
|
|
|
|
|
I created project, to capture vedio and playback , I capture Properly, But I unable to run the vedio in the Static Toolbox, I use Media Control Interface
|
|
|
|
|
To get the value (as a decimal)between two bits in a DWORD,this is what I wrote:
////////////////////////////////////
DWORD CMyBitsDlg::RevealBitsInDW(DWORD theNb,unsigned int lowBit,unsigned int highBit)
{ DWORD valueOfBits=theNb;
valueOfBits &=0xFFFFFFFF << (DWORD)lowBit;
valueOfBits &=0xFFFFFFFF >> (DWORD)(31-highBit);
return valueOfBits;
}
///////////////////////
The DWORD is input as a CString of valid Hex chars.
To format it as a DWORD,I tried:
GetDlgItemText(IDC_MYHEX,hexNb);
sscanf(hexNb, "%08X", &GivenHex);
and:
sscanf("0x"+hexNb, "%I32i", &GivenHex);
Both seem be a wrong formatting.
//////// To display the result:
DWORD value=RevealBitsInDW(GivenHex,lbit,hbit);
strResult.Format("%u",value);
GetDlgItem(IDC_MYRESULT)->SetWindowText(strResult);
////////////// Theresult displayed is not correct.
Where is my error ?
Thanks for any help.
|
|
|
|
|
Hello all, sorry this is not a specific C++ question, but I'd like to see a C++ approach. I want to make an application that receives input text, and translate (possibly interactively) every word.
But I can't find any simple API for doing this, my idea is very innocent maybe, but I just only want to have a couple of files like
language1.txt
lang1word -> esperanto
language2.txt
lang2word -> esperanto
....
(as you know, esperanto is an artifficial but universal language, the XML of human languages
After two hours of searching I've only found one free tool with vocabulary files for doing this called Ergane. The problem is those files (language1, language2, ...) are in MS Access format, and there are six tables in each mdb file, I don't want to spend time reversing that ER model since what I want to do seems very easy to me right now.
Any ideas or tips?
regards
eidan
|
|
|
|
|
Hello,
I want insert some ActiveX Controls in a CDialogBar with Visual C++.net. I can insert the controls, but the controls are not visible when the program is running.
In Visual C++ 6.0 i have no problems, when I change my DialogBar class, as in the MSDN article "185672 HOWTO: How to initialize child controls in a derived CDialogBar" described.
In addition I can insert in Visual C++ 6.0 variables over the class wizzard.
In C++.net is this not possible.
How can I use ActiveX controls in DialogBars with c++.net and how can I use the class wizard for inserting new variables in the DialogBar.
Thanks and sorry for my bad english
Alex
|
|
|
|
|
I am currently trying to learn c++, and am looking for some help. I need to know how to search the folder that my app.exe is placed in, to find all jpg files, and store the names in an array.
Regards
Paul
|
|
|
|
|
Take a look at CFileFind, FindFile and FindNextFile in MSDN
|
|
|
|
|
pls tell me an API by which i can fetch the Hardware information persent in Device Manager.
|
|
|
|
|
|
|
|
there are number of books availble for com!
like Essential Com by Don Box!
"Opinions are neither right nor wrong. I cannot change your opinion. I can, however, change what influences your opinion." - David Crow
cheers,
Alok Gupta
|
|
|
|
|
If you have an array and it initialized it with say 50 members.
now each time I execute the program a member of the array should be chosen randomly for further operation.....can it be possible?
please help.
|
|
|
|
|
use rand() ...
#include <stdlib.h>
#include <time.h>
srand((unsigned)time(NULL));
rand()%50;
TOXCCT >>> GEII power [toxcct][VisualCalc]
|
|
|
|