Re: ListDirData event in C++ (General questions)
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:
- ListDirData event in C++ - cedral, 2010-01-21, 00:08
- Re: ListDirData event in C++ - cedral, 2010-01-21, 01:51