We help IT Professionals succeed at work.

Using goback and goforward for Internet Explorer created with CreateOleObject

High Priority
221 Views
Last Modified: 2019-07-16
Hello Guys,

I create this code:

   ie := CreateOleObject('InternetExplorer.Application');
   h  := ie.hwnd;
   ie.visible      := false;
   ie.fullscreen   := false;
   ie.TheaterMode  := false;
   ie.MenuBar      := False;
   ie.AddressBar   := False;
   ie.Resizable    := true;
   ie.StatusBar    := False;
   ie.ToolBar      := 0;
   ie.Width        := Panel2.Width;
   ie.Height       := Panel2.Height+27;
   ie.top          := -27;
   ie.left         := 0;

   sleep(3000);
   windows.setparent(ie.hwnd, panel2.handle);
   ie.visible := true;
   if _htmlDireta<>'' then
     ie.Navigate(_htmlDireta)
   else
     ie.Navigate('about:blank');

Open in new window


I want to work with 2 bottons, one for goback and another to goforward.
But before using it, I need to check if my IE has changed and has a history page
How could I check my IE change?

I found the command but I don't know how to insert it into my code:

https://docs.microsoft.com/en-us/previous-versions/windows/internet-explorer/ie-developer/platform-apis/aa768361(v=vs.85)

something like in this example:

https://www.swissdelphicenter.ch/en/showcode.php?id=1158

Note: I can't use the TWebBrowse that comes with Delphi due to being out-of-date.

regards
Comment
Watch Question

CERTIFIED EXPERT
Top Expert 2016
Commented:
generally you would have to use the internet explorer active-x control. the control allows to establish an event handler, i. e. a function you provide in order to catch CommandStateChange events. those events will be fired if there is a history page and either the backwards (arrow) button needs to be enabled/disabled or the forward (arrow) button. unfortunately i don't know how active-x controls can be controlled with Delphi. i would think the TWebBrowser still would be the right choice if you would care for the the ie browser active-x control to be up-to-date,

maybe the following links could help

http://www.faisoncomputing.com/samples/webBrowser_links.htm

http://www.euromind.com/iedelphi/embeddedwb.htm

Sara

Author

Commented:
thanks a lot