ListDirData Event (wodSFTP / wodSFTP.NET / wodSFTPdll)
I'm using the wodFTPD COM object in C++ Builder 6 and I'm trying to get it to list different files than it would by default. Here's my event handler, can you tell me where I'm going wrong (and perhaps provide or point me to an example):
void __fastcall TForm1::ServerListDirData(TObject * Sender, IFtpUser* User,
LPSAFEARRAY* DirData, VARIANT_BOOL NamesOnly)
{
SAFEARRAYBOUND saBound[1];
saBound[0].lLbound = 1;
saBound[0].cElements = 1;
*DirData = SafeArrayCreate(VT_VARIANT, 1, saBound);
SafeArrayLock(*DirData);
long lx = 1;
VARIANT *pVar = NULL;
SafeArrayPtrOfIndex(*DirData, &lx, (void**)&pVar);
if(pVar)
{
pVar->vt = VT_BSTR;
pVar->bstrVal = ::SysAllocString(WideString(ClientFileList));
}
SafeArrayUnlock(*DirData);
NamesOnly = false;
}
ClientFileList is actually one long AnsiString that I build up by calling ListDir on a wodFTP COM object (i.e. the client object).