OnWindowLoad event
|
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);
|
|
If SniffWithHTTPPrefixOnly property is True, the component will detect only that windows which already have "http" prefix in the address line (shows content received by HTTP or HTTPS protocols). Otherwise, if SniffWithHTTPPrefixOnly is False, the component can detect windows with any text in the address line, even if it's "about:blank" or path to some local directory in Windows Explorer.
|
|
The OnWBDownloadComplete event will be triggered if the Explorer window was detected with IsCompleted status (if the window was not existeted on application startup but the content was already completed upon detecting the IE instance).
|
|
The OnURLChange event will occur at once after detecting of new IE window.
|
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.
|