Get details from Internet Explorer lazarus / 34-Windows ---------------------------------------------------------------------- TyneBridges · 2020-12-24 19:19 Can anyone advise me what is the simplest way of monitoring the current URL and page title in Internet Explorer (already running) using Lazarus? I have old code from Delphi where I did this with a TWebBrowser but it seems it's not easy to get this to work in Lazarus, and I need to update the program to work with 64 bit processes. I've looked at https://wiki.freepascal.org/Webbrowser and https://wiki.lazarus.freepascal.org/LazActiveX. The approach in "Creating visual ActiveX components from type libraries or objects" looks like what I need with late binding, but I don't understand how to include an Internet Explorer ActiveX object in Lazarus or whether I can get the necessary information from my old code (written many years ago). (I realise IE is an obsolescent browser; a completely different method is needed to capture Chrome logs but at least its use of a SQLite database is well enough documented for that to work.) Thank you. ---------------------------------------------------------------------- TyneBridges · 2021-01-03 19:21 On re-reading and checking, late binding means too many unknowns for me. In theory I can do this with early binding (full interfaces known to the PC) by importing the TWebBrowser ActiveX control. Unfortunately this control doesn't appear in the lists when I click "Import Type Library" from the Tools menu. Does anyone know why this is? Thanks. ---------------------------------------------------------------------- MarkMLl · 2021-01-03 20:06 What exactly are you trying to "monitor"? You might be using a steam hammer to crack a nut. MarkMLl ---------------------------------------------------------------------- marcov · 2021-01-03 21:02 Afaik twebbrowser is a Delphi shell around the imported activex object, not the object itself. ---------------------------------------------------------------------- TyneBridges · 2021-01-04 12:35 Quote from: MarkMLl on January 03, 2021, 09:06:32 pmWhat exactly are you trying to "monitor"? You might be using a steam hammer to crack a nut. MarkMLl Thanks. I may have been on the wrong track, confusing the TWebBrowser with a different facility in the program. I want to get each URL and page title in Internet Explorer, which I could do in Delphi using the following code. (Sw is declared as IShellWindows) This links to Internet Explorer and extracts the page title (T) and address (A) as a string. It still works but I'd like to update it to 64 bit and have only an old 32 bit version of Delphi. Code: Pascal  [Select][+][-]window.onload = function(){var x1 = document.getElementById("main_content_section"); if (x1) { var x = document.getElementsByClassName("geshi");for (var i = 0; i    WB: IWebBrowser2;begin    for X:= 0 to SW.Count - 1 do    begin         WB:= Sw.Item(x) as IWebBrowser2;         if WB = Nil then            AT:= ''         else begin             AT:= WB.LocationURL + '|' + WB.LocationName;             If (Uppercase(Copy(AT, 1, 4)) = 'HTTP') or (Uppercase(Copy(AT, 1, 4)) = 'FILE') then ---------------------------------------------------------------------- TyneBridges · 2021-01-06 09:22 On close inspection of the old Delphi project I see it doesn't include (so doesn't need) a TWebBrowser control. However, I do need the units ShDocVw_Tlb and ActiveX, or their Lazarus equivalents and my converted code currently doesn't compile with these references. Any tips on how I can proceed? Thanks. ---------------------------------------------------------------------- PascalDragon · 2021-01-06 10:29 The ActiveX unit is already provided with FPC. For the ShDocVw_Tlb unit you can either use the Delphi one (just add {$ifdef fpc}{$mode delphi}{$endif} at the top) or you can let Lazarus' type library importer import it: install LazActiveXgo to Tools -> Import Type Library...select Microsoft Internet Controls (doesn't matter which tab you choose) and click OkLazarus will open a new unit ShDocVw_1_1_Tlb; it doesn't look like it, but you need to save it (you can rename it to ShDocVw_Tlb then if you want to)  Now you should be able to compile your code. ---------------------------------------------------------------------- TyneBridges · 2021-01-08 09:23 Quote from: PascalDragon on January 06, 2021, 11:29:01 amThe ActiveX unit is already provided with FPC. For the ShDocVw_Tlb unit you can either use the Delphi one (just add {$ifdef fpc}{$mode delphi}{$endif} at the top) or you can let Lazarus' type library importer import it: install LazActiveXgo to Tools -> Import Type Library...select Microsoft Internet Controls (doesn't matter which tab you choose) and click OkLazarus will open a new unit ShDocVw_1_1_Tlb; it doesn't look like it, but you need to save it (you can rename it to ShDocVw_Tlb then if you want to)  Now you should be able to compile your code. Thanks - that looks just like the information I need. I think the converter did import ShDocVw_TLb from my Delphi project but, for whatever reason, it wasn't then recognised correctly by the compiler. I will remove it and try your procedure. ---------------------------------------------------------------------- TyneBridges · 2021-01-08 16:57 Thanks. After following PascalDragon's instruction, more of my converted code now is compiling but I still get an error on the following. I've tried changing the declaration TrayIconData: TNotifyIconData; to TrayIconData: TNotifyIconDataW; but I still get the error Identifier not found: Wnd. Do I need to change a reference somewhere to a pointer? Code: Pascal  [Select][+][-]window.onload = function(){var x1 = document.getElementById("main_content_section"); if (x1) { var x = document.getElementsByClassName("geshi");for (var i = 0; i     Try      With TrayIconData do        begin            cbSize:= SizeOf(TrayIconData);            Wnd:= Handle; ---------------------------------------------------------------------- marcov · 2021-01-08 16:59 ctrl-click the  "TNotifyIconDataW" type and the ide will jump to the definition. Probably it is hwnd