COM的属性为:
STDMETHODIMP Tpop3getmailImpl::get_attachcontent(VARIANT* Value)
{
  try
  {
        SourceData *pstrData ;
        pstrData=clsSourceList.Check();
        if(pstrData!=NULL)
            {//1.
               // *Value=TVariant( (BSTR)(pstrData->szBuffer));
            //2.
                //*Value=TVariant( (BYTE)(pstrData->szBuffer));
            //3.
               TVariant v(pstrData->szBuffer);
               v.ChangeType(VT_BYREF|VT_UI1);
               *Value = v;
          clsSourceList.Free();
           }
  }                                 
  catch(Exception &e)
  {
    return Error(e.Message.c_str(), IID_Ipop3getmail);
  }
  return S_OK;
}
说明:
   pstrData->szBuffer为内存队列,存放有二进制数据流。 
   1,2,3,三种方式编译过的COM组件在ASP中调用均不报错。但二进制流却有损失。
ASP调用如下:
    <% 
Response.buffer = TRUE
Response.ContentType = "APPLICATION/OCTET-STREAM"
Response.AddHeader "Content-Disposition","attachment;filename="&"ok.exe"
Set objStream = Server.CreateObject("webmail.pop3getmail")
'objStream.getmail 将二进制流读入内存队列,这一步确定没错
objStream.getmail "E:\email server\data\20030429\20030429094501022678.eml",1,2
 do  while 1=1
t=objStream.attachcotent
if len(t)=0 then
exit do
end if
         Response.BinaryWrite(t)
t=""
 loop
objStream.clearlist
objStream.freesource
Set objStream = Nothing
%>
为什么输出的文件大小有问题呢?
请教高手赐教,不胜感激!定送分,不够再加。在线等待