2

I have been trying to follow this tutorial I found:

How to call Delphi code from scripts running in a TWebBrowser (part 2 of 6)

It explains how I can call Delphi functions through JavaScript. I don't properly understand how it works, but at the moment that is not important and I am just trying to get it to work.

I tried to follow it exactly, but I am getting an error when I try to compile:

Error loading type library/dll

Upon downloading their example, I noticed they had a .tlb file in the program, apparently this should have been created through the Type Library Editor, but I don't have such a file in my project. I believe this is creating the error, but I may be wrong.

Why isn't this file being created? How can I create that file?

I can't think of any code or screen grabs that could be useful, so please let me know if there are any I should include.

Remy Lebeau
  • 555,201
  • 31
  • 458
  • 770
  • Delphi stopped relying on `.tlb` files in D2009 when it switched to using [`.ridl` files](http://docwiki.embarcadero.com/RADStudio/en/RIDL_File) to define Type Libraries. If you still need a binary `.tlb` file, look at Delphi's [`GenTLB.exe`](http://docwiki.embarcadero.com/RADStudio/Rio/en/GenTLB.exe) utility. – Remy Lebeau Apr 27 '20 at 19:33
  • @RemyLebeau Oh ok, so is that not the reason I am getting the error? This stuff is quite passed my level so I am a bit lost – Oliver Hope Apr 27 '20 at 20:21
  • that tutorial predates the invention of RIDL. But like I said, you can still produce a `.tlb` file if you really need one. But I don't think you do. You just need a Type Library resource embedded in whatever EXE/DLL the WebBrowser will be accessing, and that embedding is very easy to do in a Delphi project, whether TLB or RIDL is used to define it. Your error is likely related to you not setting up that embedding correctly, not because you are missing a `.tlb` file. – Remy Lebeau Apr 27 '20 at 20:49
  • @RemyLebeau Alright thank you, I will attempt that and see if fixes the problem – Oliver Hope Apr 27 '20 at 20:54

0 Answers0