The Delphi Open Tools API Book

An update to the book is here 🙂



Well I’ve never written a book before so this may not be War and Peace on the Open Tools API that everyone wants but I hope that it goes some way towards filling the gap in the documentation that has existed. I would, if I had time, like to cover all of the Open Tools API, especially the ToolsAPI.pas file but that is a massive undertaking which I don’t have the time to do unfortunately. Should I get a nice 9 to 5 job around the corner from where I live which would keep me in the life I’m accustom to, then I might have a go.
For me working with the Open Tools API started with Delphi 3 all those many moons ago. The Open Tools API started with Delphi 2 (first 32-bit version) which allowed you to programme the IDE however it used a very different interface mechanism than is now in use today and one that I cannot even remember. I got a little help back then from an excellent book by Ray Lischner called the Hidden Paths of Delphi 3 which I read from start to finish (and still have) and if I remember correctly, created all the example code contain there in. I still think that if you can find this book its worth reading. There are many aspects to the Open Tools API and this book generally only covers those aspect contained within the ToolsAPI.pas file. There are many other files in the Open Tools API (have a look at the Source\ToolsAPI\ directory in you installation, these files allow you to do other things like create your own property inspectors, virtual filing systems, proxies and much more.

Why did I start to investigate the Open Tools API? Well initially it seemed an interesting thing to learn (back in the days when I have way too much time on my hands) but eventually there came a point when I needed to solve a problem that the IDE either didn’t do or didn’t do it properly. The first instance of this was with Delphi 5’s module/code explorer which would just lock up (the rest of the IDE functioned). So I wrote PascalDoc, a code browser and documentation tool. This has since been supersede by Browse and Doc It which does the browsing, the documentation but also helps with profiling code with instrumentation and creating DUnit projects and modules. Later on when I started to use DUnit more and wanted to automate the compiling and running of the tests before compiling the main project, I created the Integrated Testing Helper.

The contents of this book are mostly a collection of blogs I wrote over a number of years on the Delphi Open Tools API. I haven’t done much to the chapters other than correct spelling mistakes and grammar as the chapters describe a journey through a learning process which I hope the reader will appreciate.

The chapter numbers are different here than the original blogs as I’ve included all the incidental information on the Open Tools API which I think adds to this knowledge base. There are a number of mistakes in some of the articles which are identified and corrected in later chapters as they were in the original blogs. It is therefore suggested to read the whole of this book to ensure you know about any issues in the earlier articles.

The reason for the blogs originally was to write down all that I had found out while trying to implement Open Tools API code so that I had a reference as to why I had done things in a particular way but also to provide the same information to the wider Delphi community. I’ve also written a number of new chapters on topics that have been outstanding for several years.

Additionally, all the referenced code examples are contained in a number of ZIP files above on this web page. The example code is free for all to use as they see fit. The code for Browse and Doc It and the Integrated Testing Helper is provided for reference. The Open Tools API aspects of the code are also free to be used however I do reserve all writes to the remaining code which is provide for information purposes only and not for redistribution or reuse.

I haven’t done very much with Delphi and the Open Tools API in the past few years other than maintain some of my existing applications however I’m not down and out yet! Although I don’t know whether I’ll get time to do any more investigation into the Open Tools API I have in the back of my mind that I would update this book and publish the additional material for all. In trying to finish this book I skipped across an IOTA interface for the help system. One of the annoyances of the latest IDEs is their lack of MS Win32/64 SDK help so I might investigate whether I can intercept this F1 context key press and redirect them to a browser and bring up the MSDN reference. Like most of these things I have done, I have no idea whether I can do it but I’ll have a go and let you know.

Finally, I’m sure that there are going to be some spelling mistakes, grammatical errors as well as issues with the code so I would appreciate constructive feedback on the book, its contents, style, etc. and I will attempt to update the book at a future time. Also I would like to thank David Millington for encouraging me to get my head backing into the Open Tools API and writing this book.
Hope you all enjoy.

David Hoyle @ Sep 2016

7 thoughts on “The Delphi Open Tools API Book

  1. Jan Doggen

    Thank you, David! I just started my first OTAPI project yesterday (a visual inspector).

    One remark: You say *the referenced code examples are contained in a number of ZIP files attached to this PDF*, but the link is just the PDF, no source.

    1. David Post author


      I’ve just downloaded and checked the PDF with PDF Exchange and Adobe Acrobat Reader and it does have attachments in it (you need to open the attachments panel to see them). Are you using a different PDF viewer?


  2. Eric ten Westenend

    Great work!

    Thanks a lot, i have to move from D2007 to D10 Seatlle and i’m sure i can use this book a lot, i have a lot of components and component editors and IDE wizards.


  3. Achim

    Hello David,
    is it possible to extend the pascal-Highlighter from Delphi?
    I would like to Highlight a special comment in a diffrent Color.
    for example;
    special comment:
    { #Tag n3456 maintenance new Feature Button now blue } -> Special comment color
    other comment:
    { bla bla bla } -> Standard comment Color

    thanks for your help

    1. David Post author


      You cannot extend/override an existing highlighter. The only 2 approaches I can think of are:
      1) Write a new pascal highlighter to replace the existing one. The code I’ve provided does most of this for you so you would only have to make some changes and manually apply this to .pas files. I don’t know whether the IDE has this hard coded and will allow it. This is the easiest option;
      2) Hack the IDE and draw on top of the code editor a la Castalia (now part of RAD Studio 10 Seattle) or Parnassus Bookmarks – on the later David Millington has written a blog article on how some of this works (

  4. Pawe? Glowacki

    Hi Dave, Link to the pdf seems to be broken. Could you check?

    1. David Post author

      Hi Pawel,

      I’ve just checked with IE and Firefox (here at work) and both have downloaded the PDF and opened them in a PDF viewer.
      Do you get an error message?

Comments are closed.