Re: ListDirData event in C++ - WeOnlyDo Discussion board

Re: ListDirData event in C++ (General questions)

by cedral, Thursday, January 21, 2010, 01:51 (5419 days ago) @ cedral

The answer is to fix the broken prototype in the fast notification mfc example. it should have been SAFEARRAY **, not SAFEARRAY*.

the following example works.

STDMETHODIMP CwodFTPDNotify::XNotify::ListDirData(IwodFTPDCom* Owner, IFtpUser* User, SAFEARRAY ** DirData, VARIANT_BOOL NamesOnly)
{
METHOD_PROLOGUE(CwodFTPDNotify, Notify);
FILE *f = fopen(DIRLISTING, rb );
if(f)
{
BYTE arrayBytes[256];
CComSafeArray<BYTE> arrayDirData;
int i = 0;
while((i = fread(arrayBytes, sizeof(BYTE), 256, f)))
{
for(int j = 0; j < i; j++)
{
arrayDirData.Add(arrayBytes[j]);
}
}
fclose(f);
arrayDirData.CopyTo(DirData);
}
return S_OK;
}


Complete thread: