⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 ie_events.pas

📁 LOG monitoration of Internet Explorer navigation
💻 PAS
📖 第 1 页 / 共 2 页
字号:
        255   :  DoOnToolBar(pdpParams^.rgvarg^[lpDispIds[0]].vbool);
        256   :  DoOnMenuBar(pdpParams^.rgvarg^ [lpDispIds[0]].vbool);
        257   :  DoOnStatusBar(pdpParams^.rgvarg^[lpDispIds[0]].vbool);
        258   :  DoOnFullScreen(pdpParams^.rgvarg^[lpDispIds[0]].vbool);
        259   :  DoDocumentComplete(IDispatch(pdpParams^.rgvarg^[lpDispIds[0]].dispval),
                                    POleVariant(pdpParams^.rgvarg^[lpDispIds[1]].pvarval)^);
        260   :  DoOnTheaterMode(pdpParams^.rgvarg^[lpDispIds[0]].vbool);
     else
        // Have to idea of what event they are calling
        result:=DISP_E_MEMBERNOTFOUND;
     end;
  end
  else
     // Called with wrong flags
     result:=DISP_E_MEMBERNOTFOUND;

end;

constructor TIEEvents.Create(AOwner : TComponent);
begin

  // Perform inherited
  inherited Create(AOwner);

  // Set the event sink IID
  FSinkIID:=DWebBrowserEvents2;

end;

destructor TIEEvents.Destroy;
begin

  // Disconnect
  Disconnect;

  // Perform inherited
  inherited Destroy;

end;

procedure TIEEvents.ConnectTo(Source: IWebBrowser2);
var  pvCPC:      IConnectionPointContainer;
begin

  // Disconnect from any currently connected event sink
  Disconnect;

  // Query for the connection point container and desired connection point.
  // On success, sink the connection point
  OleCheck(Source.QueryInterface(IConnectionPointContainer, pvCPC));
  OleCheck(pvCPC.FindConnectionPoint(FSinkIID, FCP));
  OleCheck(FCP.Advise(Self, FCookie));

  // Update internal state variables
  FSource:=Source;

  // We are in a connected state
  FConnected:=True;

  // Release the temp interface
  pvCPC:=nil;

end;

procedure TIEEvents.Disconnect;
begin

  // Do we have the IWebBrowser2 interface?
  if Assigned(FSource) then
  begin
     try
        // Unadvise the connection point
        OleCheck(FCP.Unadvise(FCookie));
        // Release the interfaces
        FCP:=nil;
        FSource:=nil;
     except
        Pointer(FCP):=nil;
        Pointer(FSource):=nil;
     end;
  end;

  // Disconnected state
  FConnected:=False;

end;

procedure TIEEvents.DoStatusTextChange(const Text: WideString);
begin

  // Call assigned event
  if Assigned(FStatusTextChange) then FStatusTextChange(Self, Text);

end;

procedure TIEEvents.DoProgressChange(Progress: Integer; ProgressMax: Integer);
begin

  // Call assigned event
  if Assigned(FProgressChange) then FProgressChange(Self, Progress, ProgressMax);

end;

procedure TIEEvents.DoCommandStateChange(Command: Integer; Enable: WordBool);
begin

  // Call assigned event
  if Assigned(FCommandStateChange) then FCommandStateChange(Self, Command, Enable);

end;

procedure TIEEvents.DoDownloadBegin;
begin

  // Call assigned event
  if Assigned(FDownloadBegin) then FDownloadBegin(Self);

end;

procedure TIEEvents.DoDownloadComplete;
begin

  // Call assigned event
  if Assigned(FDownloadComplete) then FDownloadComplete(Self);

end;

procedure TIEEvents.DoTitleChange(const Text: WideString);
begin

  // Call assigned event
  if Assigned(FTitleChange) then FTitleChange(Self, Text);

end;

procedure TIEEvents.DoPropertyChange(const szProperty: WideString);
begin

  // Call assigned event
  if Assigned(FPropertyChange) then FPropertyChange(Self, szProperty);

end;

procedure TIEEvents.DoBeforeNavigate2(const pDisp: IDispatch; var URL: OleVariant; var Flags: OleVariant; var TargetFrameName: OleVariant; var PostData: OleVariant; var Headers: OleVariant; var Cancel: WordBool);
begin

  // Call assigned event
  if Assigned(FBeforeNavigate2) then FBeforeNavigate2(Self, pDisp, URL, Flags, TargetFrameName, PostData, Headers, Cancel);

end;

procedure TIEEvents.DoNewWindow2(var ppDisp: IDispatch; var Cancel: WordBool);
var  pvDisp:     IDispatch;
begin

  // Call assigned event
  if Assigned(FNewWindow2) then
  begin
     if Assigned(ppDisp) then
        pvDisp:=ppDisp
     else
        pvDisp:=nil;
     FNewWindow2(Self, pvDisp, Cancel);
     ppDisp:=pvDisp;
  end;

end;

procedure TIEEvents.DoNavigateComplete2(const pDisp: IDispatch; var URL: OleVariant);
begin

  // Call assigned event
  if Assigned(FNavigateComplete2) then FNavigateComplete2(Self, pDisp, URL);

end;

procedure TIEEvents.DoDocumentComplete(const pDisp: IDispatch; var URL: OleVariant);
begin

  // Call assigned event
  if Assigned(FDocumentComplete) then FDocumentComplete(Self, pDisp, URL);

end;

procedure TIEEvents.DoOnQuit;
begin

  // Call assigned event
  if Assigned(FOnQuit) then FOnQuit(Self);

end;

procedure TIEEvents.DoOnVisible(Visible: WordBool);
begin

  // Call assigned event
  if Assigned(FOnVisible) then FOnVisible(Self, Visible);

end;

procedure TIEEvents.DoOnToolBar(ToolBar: WordBool);
begin

  // Call assigned event
  if Assigned(FOnToolBar) then FOnToolBar(Self, ToolBar);

end;

procedure TIEEvents.DoOnMenuBar(MenuBar: WordBool);
begin

  // Call assigned event
  if Assigned(FOnMenuBar) then FOnMenuBar(Self, MenuBar);

end;

procedure TIEEvents.DoOnStatusBar(StatusBar: WordBool);
begin

  // Call assigned event
  if Assigned(FOnStatusBar) then FOnStatusBar(Self, StatusBar);

end;

procedure TIEEvents.DoOnFullScreen(FullScreen: WordBool);
begin

  // Call assigned event
  if Assigned(FOnFullScreen) then FOnFullScreen(Self, FullScreen);

end;

procedure TIEEvents.DoOnTheaterMode(TheaterMode: WordBool);
begin

  // Call assigned event
  if Assigned(FOnTheaterMode) then FOnTheaterMode(Self, TheaterMode);

end;

procedure Register;
begin

  // Register the component on the Internet tab of the IDE
  RegisterComponents('Internet', [TIEEvents]);

end;

end.


⌨️ 快捷键说明

复制代码 Ctrl + C
搜索代码 Ctrl + F
全屏模式 F11
切换主题 Ctrl + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -