function TIEMonitor.Invoke(DispID: Integer; const IID: TGUID; LocaleID: Integer;
      Flags: Word; var Params; VarResult, ExcepInfo, ArgErr: Pointer): HResult;
type
  POleVariant=^OleVariant;
var
  dps:TDispParams absolute Params;
  bHasParams:Boolean;
  pDispIDs:PDispIDList;
  iDispIDsSize:Integer;
begin
  Result:=DISP_E_MEMBERNOTFOUND;
  pDispIDs:=nil;
  iDispIDsSize:=0;
  bHasParams:=(dps.cArgs>0);
  if(bHasParams)then
  begin
    iDispIDsSize:=dps.cArgs*SizeOf(TDispID);
    GetMem(pDispIDs,iDispIDsSize);
  end;
  try
    if(bHasParams)then BuildPositionalDispIDs(pDispIDs,dps);
    case DispID of
      250:begin
          DoBeforeNavigate2(IDispatch(dps.rgvarg^[pDispIDs^[0]].dispVal),
            POleVariant(dps.rgvarg^[pDispIDs^[1]].pvarVal)^,
            POleVariant(dps.rgvarg^[pDispIDs^[2]].pvarVal)^,
            POleVariant(dps.rgvarg^[pDispIDs^[3]].pvarVal)^,
            POleVariant(dps.rgvarg^[pDispIDs^[4]].pvarVal)^,
            POleVariant(dps.rgvarg^[pDispIDs^[5]].pvarVal)^,
            dps.rgvarg^[pDispIDs^[6]].pbool^);
          Result:=S_OK;
        end;
      XXX://这个数应该是多少
        begin
  更改IE打印设置中的边距,纸方向,纸型,打印机
end;
      253:begin
          DoOnQuit();
          Result:=S_OK;
        end;
    end;//end of case DispID of
  finally
    if(bHasParams)then
      FreeMem(pDispIDs,iDispIDsSize);
  end;
end;我现在不知道DispID为多少的时候会触发IE打印事件(类似onbeforeprint的事件),还有就是即使触发了事件的话,我需要重载哪个类的哪个事件来实现我想要的功能,望各位大合侠剔教, 这个是我写的例子,现在重载了一个DoBeforeNavigate2(打开网页地址)的过程,我想即然能重载这个方法,那么就也应该能重载设置打印机的过程,可是我现在不知道该怎么做 我引用了一个mshtml单元里面有几个方法(marginTop,marginRight,marginBottom,marginLeft)好像是用来设置IE打印时的边距的,可是我不知道怎么用