The Road to Delphi

Delphi – Free Pascal – Oxygene

Introducing the Delphi Preview Handler


To download the last version of the delphi preview handler check the new page of the project.

The current beta version of the preview handler (DelphiPreviewHandler.dll)  is  please check the version installed before you report bugs.

Some weeks ago I began a parallel project to the Delphi IDE Theme Editor, I name this project Delphi Preview Handler, which basically is a preview handler for windows vista and  7 which allow you read your object pascal, C++ and Assembly code with Syntax highlighting without open in a editor, this preview handler can render these file extensions .pp, .lpr, .lfm, .lpk, .inc, .pas, .dpr,.dfm, .dpk,.dproj, .bdsproj,.c, .cpp,. cc,.h, .hpp,.hh, .cxx, .hxx, . cu, .asm.


  • Supports Windows Vista y Windows 7 32 and 64 bits.
  • +50 themes included to see your code with style
  • Themes compatibles with the Delphi IDE Theme Editor
  • Support these file extensions .pp, .lpr, .lfm, .lpk, .inc, .pas, .dpr,.dfm, .dpk,.dproj, .bdsproj,.c, .cpp,. cc,.h, .hpp,.hh, .cxx, .hxx, . cu, .asm.

Technical Stuff

  • Written in Delphi XE
  • Components used SynEdit



Source Code

Soon, very soon.

Manual Installation

Follow these steps to register the preview handler

1. Choose Start > All Programs > Accessories.
2. Right-click on Command Prompt, Select Run As Administrator, and Authenticate.
3. Go to Delphi Preview Hander folder in Command Prompt.
4. Run “Register.bat”
5. Enjoy

Important Note about editing the Settings.ini file

You can change  the theme used in the Preview Handler editing the Settings.ini file, but before to do this you must unregister the preview handler and close all the explorer windows. to avoid problems. please follow these steps :

1. unregister the dll

2.close all the windows explorer

3.edit the Settings.ini file the changes

5.register the dll


Important Note about installing  a new version

In order to avoid problems you must follow these steps when you install or register a new version of the preview handler.

1. close all the windows explorer windows which have the preview handler active or the preview handler was used (remember the dll remains in memory until the windows explorer was closed)

2. unregister the previous version executing the uninstaller located in C:\Program Files (x86)\TheRoadToDelphi\DelphiPreviewHandler or C:\Program Files\TheRoadToDelphi\DelphiPreviewHandler

3. If you install the preview handler manually you must unregister using the UnRegister.bat  running as admin.

4.Now proceed with the installation of the new version.

Download the Binaries of the Delphi Preview Handler from here

Download the Installer (recommended) of the Delphi Preview Handler from here

All your suggestions and comments are very welcome.

Author: Rodrigo

Just another Delphi guy.

62 thoughts on “Introducing the Delphi Preview Handler

  1. Hi,

    Looks nice!

    I just whipped togheter a preview handler based on another post (, and made a register batch file for it. However, you need to run it as administrator, which will change your working dir, which needs to be addressed in the bat file.

    Here’s what I came up with:

    @echo off

    echo Register Cargolog Data Preview handler
    regsvr32 %~dp0CargologDataPreviewHandler.dll

    echo Done.

    echo FAILED. Perhaps you forgot to start this with the “Run as Administrator” option from the context menu.


  2. This is very usefull! I installed it and will not uninstall it ever again.
    I’d very much like to have a look at the source of you are willing to share!

  3. I’m using Windows 7 Ultimate x64… installed your lovely Preview Handler, however…

    DFM and DPR previews work great, but .pas files don’t show at all. Probably a small bug somewhere, but figured I’d let you know.

  4. Love it, keep up the good work!!!

  5. Not work. :(

  6. Very cool! I had a slight problem with installation. To get the DLL to register, I had to:

    1. Choose Start > All Programs > Accessories.
    2. Right-click on Command Prompt, select Run As Administrator, and authenticate.
    3. Go to Delphi Preview Hander folder in Command Prompt.
    4. Run “Register.bat”

    Very pleased with this utility (and the theme editor as well).


  7. You are a genius! Great work. I’m gonna try this tomorrow when I go into work. Thank very much.

  8. I registered the Delphi Preview Handler and it’s working with everything but .PAS files. I have the .PAS file extension associated with MultiEdit on my machine. Could that be causing the problem?

  9. Nice work!

    I’m getting an error trying to register it:
    The module “DelphiPreviewHandler.dll” was loaded but the call to DllRegisterServer failed with error code 0x80004005.
    I’m using Windows 7 (32bits).

    Any suggestions?

  10. Hey! What kind of coffee you drink? Maybe I need some of that too! :D
    Keep the good working Rodrigo.

  11. It’s wonderful!!!
    Can you also make this as a plugin to Total Commander?

    • By the way I got an error after closing the Windows Explorer window:
      “Runtime error 217 at 01804171”

      Operating system is Windows 7 x32 and Image base of your dll when loaded to prevhost.exe is 017E0000

      • This issue occurs every time which the explorer windows is closed? are modifying the settings.ini file while the preview handler still loaded?

        • Yes it occurs everytime I close windows explorer. What I do was installed it with the bat, preview some files, then close the windows explorer. After that I changed the theme and viewed some more files.
          btw I also lost the file associations..

  12. Very nice and handy!

    Works great in Win7 SP1 64-bits, but had that runtime error which mentioned by another user once after installation, testing it in the explorer, and closing explorer window. Since then, the runtime error didn’t occur. I guess the first one happened because the explorer window was open during the installations.

    Anyways, thanks alot!

    • Ali, can you describe the exact scenario (the steps necessaries to reproduce) , to try to replicate in my machine?

      • Well, I just ran the installer, then opened an explorer window, opened preview pane, and clicked on a few .Pas, .DPR, .DFM files, then closed the explorer window, and got the runtime error. Opened explorer again and tried previewing some source files again, then closed the explorer and this time there was no runtime error.

        BTW, I had to uninstall it because just like Vany, I lost file association after restarting Windows and to restore it, I had to uninstall preview handler.

        Although file association was broken after restart, the preview was functioning properly without any runtime error. So I think the runtime error occurs only once just after the first time explorer is used after preview handler installation.

        Thank you anyway :)

        • Ali, thanks for you information I detect the issue and I am fixing now.

        • Ali, the bug of the file associations was fixed and I added the eurekalog to the dll to capture and report issues, sorry for the problem :D

          • Rodrigo, thank you so much for your good work, it seems file association is fixed but there are still a few problems:

            1- Still running explorer after installing preview handler will cause the handler to raise an error when explorer window is closed. I sent you a bug report on this.

            2- Once the runtime error is raised, the handler will stop working, even restarting explorer doesn’t seem to fix it.

            3- Zoom buttons work fine but the little bug button and style combobox do not work on my system. They are there but clicking on them will just flicker the explorer window without bringing up anything.

            4- When the preview pane has the focus, mouse wheel still affects the file list rather than the source code. That is, when you scroll using mouse wheel, the source in the preview pane doesn’t move, instead the files list in the explorer starts scrolling.

            Best Regards

          • Ali about the point 1) I don’t receive yet the report which you mention (do you refer to the elf file generated by the eurekalog? if is yes , try sending this file to theroadtodelphi dot about the others points I can’t reproduce :( , You can please send the details of your system and type of user which your are using to make more tests.

  13. Good Job!! Working Fine…

  14. Hi

    Great work…

    I installed yesterday, and worked perfectly. But, this moring when I started my PC the file associations of the .pas, .dfm, .dpr…. with Delphi dissapeared, I associated them again with Delphi, but then the Preview stopped to work, I tried to unregister and register again, but now it doesn’t work anymore.

    Thx ;)

  15. I don’t know if it is possible (or feasible), but it would be really cool, if the preview of a .DFM file was (optionally?) the form itself and not the source code.

    Ie. load the .DFM file into a TForm and display the form’s image in the preview pane…

  16. Hi there, this certainly seems like an awesome tool and I would love to try it out.
    The download links are no longer working it seems, or am I just obtuse?

    Much appreciated and thank you for maintaining such a brilliant resource here.

  17. Hi, this is very nice! It works also well in Directory Opus 10 file-manager (

    One question: How can I VISUALLY edit the theme files?

  18. very good ^_^

  19. Chinese displaying has a problem, display garbled state.

  20. Very cool – but I would have preferred if the default preview style was the same as the one configured for Delphi.

    • Seems that I am unable to use the theme selection combo. Screen just flickers, but no combo drops down. (Windows 7 Ultimate 64-bit, Sp 1)

      • Lars sorry for that, another user report the same issue, unfortunately I can’t reproduce this problem on my test environment,. In a few days I will publish the full source code, then maybe you or another user can help me to debug the dll and find the issue.

      • I have same problem under Windows 7 64bit. Can’t switch style with combobox.

  21. Pingback: Diego M. Garcia » Ótimo plugin para explorer poder pré-visualizar códigos delphi !

  22. Great works!!!

  23. Hi there,
    I have recently upgraded to Delphi XE2 on Windows 7 64 bit. The following error occurs from time to time when Delphi is running:

    “Error in TComPreviewHandler.IPreviewHandler_DoPreview – Message : System Error. Code 87. The parameter is incorrect: Trace”

    Any assistance would be appreciated.

  24. Pingback: Delphi Preview Handler - ابزاری برای نمایش فایلهای پروژه در preview pane

  25. I’m using Windows 7 Ultimate x64 and the preview handler is a huge resource hog.
    I try to play games but the system is tied up servicing preview handler and the games are un-playable.

    Apart from this, it works well.

Leave a Reply

Fill in your details below or click an icon to log in: Logo

You are commenting using your account. Log Out /  Change )

Twitter picture

You are commenting using your Twitter account. Log Out /  Change )

Facebook photo

You are commenting using your Facebook account. Log Out /  Change )

Connecting to %s