![]() |
![]() ![]() ![]() |
acIESniffer component.
|
type
|
TacWindowLoadState = (lsExistsLoading, lsExistsCompleted, lsLoading, lsCompleted);
|
|
TacIESnifferLoadEvent = procedure(Sender: TObject; const URL: String; const Browser: IWebBrowser2;
|
State: TacWindowLoadState) of object;
|
|
property OnWindowLoad: TacIESnifferLoadEvent;
|
The OnWindowLoad event occurs when the component detects new Internet Explorer window.
|
|
The URL parameter is the text sniffed from the address line, Browser is the pointer to the TWebBrowser2 interface, detected by component. You can use the properties and methods of Browser right in this event handler.
|
|
The State parameter determines whether the Internet Explorer window was already exists when your application started and whether the content of the Web page are completely loaded. There is 4 possible values for this parameter:
|
Value | Meaning
|
lsExistsLoading | the IE window was already running before your application started. Its content was not completely loaded (still downloading);
|
lsExistsCompleted | the IE window was already running before your application started and all its content was completely loaded (so you can change);
|
lsLoading | this is new IE window detected by program. The Web page still loading;
|
lsCompleted | this is new IE window, and the Web page already completed (even ready to be modified!, see OnWBDownloadComplete event for more details and sample code which shows how to dynamically modify the Web page content);
|
|
![]() |
|
![]() |
|
![]() |
procedure TForm1.acIESniffer1WindowLoad(Sender: TObject; const URL: String;
|
const Browser: IWebBrowser2; State: TacWindowLoadState);
|
const
|
StateStr: Array[TacWindowLoadState] of String = ('Exists Loading', 'Exists Completed',
|
'New Loading', 'New Completed');
|
begin
|
Label1.Caption := StateStr[State];
|
if (State = lsExistsCompleted) or (State = lsCompleted) then
|
IESniffer.ReplaceText(Browser, 'Delphi', 'Delphi Rules!');
|
end;
|
SniffWithHTTPPrefixOnly property;
|
OnWindowUnload, OnWBDownloadComplete and OnURLChange events.
|