ctiberg wrote:OK, here goes. Here's a type I've declared:
typedef vector<WIN32_FIND_DATAA> WIN32_FIND_DATAA_VECTOR;
I've received enough help to feel that I'll be able to do the FsFindFirst function, at least syntactically

Now the problem is in FsFindNext, where I've got the following:
WIN32_FIND_DATAA_VECTOR* vec = (WIN32_FIND_DATAA_VECTOR*) Hdl;
That does seem to get me the vector that I returned from FsFindFirst. But then I can't seem to get at an element, or to remove it from the vector. Here's what I have:
FindData = vec[0];
vec->erase(0, 0);
None of the statements compile, and I can't get my head around why they don't
The next problem comes in FsFindClose, how do I get rid of the vector? Assuming that I use the same stuff as in FsFindNext (above), can I use
delete vec
to get rid of it?
I've uploaded the whole project to
http://www.drop.io/ctiberg - please take a look at it, and if you do please re-upload it with another name
I'll worry about the other parts of the plugin later, right now I'm busy eating a C++ book
One other thing - how do I get "Microsoft Visual C++ 2008 Express Edition" to name the resulting file .wfx instead of .dll?
Ok, several things which I would do in another way:
instead of:
typedef vector<WIN32_FIND_DATAA> WIN32_FIND_DATAA_VECTOR;
use:
typedef vector<WIN32_FIND_DATAA*> WIN32_FIND_DATAA_VECTOR;
Each vector element must be a pointer! So in your enumPodcasts function you should do something like that:
Code: Select all
WIN32_FIND_DATAA_VECTOR enumPodcasts(void)
{
WIN32_FIND_DATAA_VECTOR vec;
char buf[2048];
int bufSize = 2048;
char* str;
GetPrivateProfileSectionA("PodCatcherFS", buf, bufSize, iniName);
str = buf;
while (str)
{
strcpy_s(en.cFileName, MAX_PATH, str);
WIN32_FIND_DATAA en = new WIN32_FIND_DATAA();
en.dwFileAttributes = FILE_ATTRIBUTE_DIRECTORY;
en.nFileSizeHigh = 0;
en.nFileSizeLow = 0;
vec.push_back(en);
str += strlen(str);
}
return vec;
//return static_cast<HANDLE>(&vec);
}
Then, in FsFindClose, iterate through all vector elements and delete each of it, i.e. delete (WIN32_FIND_DATAA*) vec[0];, delete (WIN32_FIND_DATAA*) vec[1]; and so on.
But, what i personally would do... I would make your vector to a global variable instead of passing it between functions, i.e. define it just like int myPluginNr;...
typedef vector<WIN32_FIND_DATAA> WIN32_FIND_DATAA_VECTOR;
WIN32_FIND_DATAA_VECTOR g_vec;
And then just work with g_vec. g_vec itself cannot be deleted since it is a stack variable. So just delete all elements/pointer and you're done
Concerning the wfx/dll file. In the project properties, there should be an entry for the output filename, i.e. Debug\my.dll There, you can replace dll with wfx.
HTH a bit
Regards,
CoolWater