The Road to Delphi

Delphi – Free Pascal – Oxygene

Delphi Preview Handler

UPDATE : The Delphi Preview Handler now is hosted on Github


The Delphi Preview Handler,  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 an 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



Suggestions and Bugs report

Source Code


Check the link on the  project page

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 Handler 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.

27 thoughts on “Delphi Preview Handler

  1. Pingback: Introducing the Delphi Preview Handler « The Road to Delphi – a Blog about programming

  2. Pingback: Delphi Preview Handler – source code published in google code « The Road to Delphi – a Blog about programming

  3. Many thanks for this. Using Win7 64-bit if I click on a file in the details pane then click on the preview pane I cannot use the mouse-wheel to scroll – must use the scroll-bars. Is mouse-wheel scrolling to become available?

  4. Cool stuff :) many thanks.

  5. Hi,
    First of all, I’d like to thank you for this tool. I think it will be very usefull.
    When I tried to register the DLL I received the message “there was a fail when calling DllRegisterServer”
    Do you know why?
    I am using Windows Vista.
    Thank you again.

    • Hi Thiago, a few questions, are you using the installer or the manual resgitration? if you are doing manually , do you follow the instructions to register the preview hanlder (running a cmd.exe windows as admin and then from that window execute the register.bat)?

      • Rodrigo, thank you for your answer.
        I installed using the installer. Then, I tried to register it using cmd.exe (as admin) and running register.bat).

  6. Rodrigo,
    I don’t what to do. I checked the event viewer but I found nothing.
    Thank you anyway.

  7. For non delphi projects I’m using this Source Preview Handler:

    • This is a very nice preview handler. Stay tuned in the next days I will upload a new version of the delphi preview handler with many fixes and improvements.

  8. I like this blog, Rodrigo u’re very genius man ;)

  9. Can this be done in Delphi 2010? I don’t have XE yet (not an easy task upgrading a companies flagship products Delphi version these days) and tried using this source in 2010 however, naturally it chokes on syntax in ComObj.pas which I’d expect. I just don’t want to pursue hacking it up if it can’t be done to begin with.

    • Yes can be done with delphi 2010, only you must add some additional types and interfacce declarations.

    • Hi, John. I’m trying to compile it with D2010. Did you solve ComObj.pas errors?

      • Finally, I did it! I could compile with D2010. I added a class helper to fix the things that TComServerObject class doesn’t have in D2010, and the function DLLInstall. I also add support for extensions that I usually use (php,html,css,javascript,python,sql, etc.) and buttons to copy higlighted code in rtf and html format to the clipboard. All this was possible thanks to Rodrigo (and Synedit components).
        The missing code for uPreviewHandlerRegister unit:

        TComServerObjectHelper = class helper for TComServerObject
        class var FPerUserRegistration: Boolean;
        class procedure GetRegRootAndPrefix(var RootKey: HKEY;var RootPrefix: string);
        class property PerUserRegistration: Boolean read FPerUserRegistration write FPerUserRegistration;

        class procedure TComServerObjectHelper.GetRegRootAndPrefix(var RootKey: HKEY; var RootPrefix: string);
        if (FPerUserRegistration) then
        RootKey := HKEY_CURRENT_USER;
        RootPrefix := ‘Software\Classes\’;
        RootKey := HKEY_CLASSES_ROOT;
        RootPrefix := ”;

        function DllInstall(bInstall: WordBool; pszCmdLine: LPCWSTR): HResult; stdcall;
        SavePerUserVal: Boolean;
        SavePerUserVal := ComServer.PerUserRegistration;
        if StrIComp(pszCmdLine, PWideChar(‘user’)) = 0 then
        ComServer.PerUserRegistration := True
        ComServer.PerUserRegistration := False;
        if (bInstall) then
        Result := DllRegisterServer();
        if Result = E_FAIL then
        Result := DllUnregisterServer();
        ComServer.PerUserRegistration := SavePerUserVal;

  10. Pingback: Johni Douglas Marangon » Dicas – Delphi Preview Handler

  11. Hello Rodrigo,

    On a recommendation from Embarcadero, I have been browsing your site.
    I came across your preview handler which interests me. I attempted to download the installer but DropBox advises me that the file is no longer available:
    “Restricted Content”
    “This file is no longer available. For additional information contact Dropbox Support. ”
    Any ideas why this would be?
    Many thanks and much appreciated

  12. That was a blindingly quick response, many thanks .
    Installed and running well.
    Also, the preview works well in a well known 3rdParty “Windows Explorer” replacement :-)

  13. Pingback: Apple:Code viewer with color syntax integrated to the finder preview panel – Apple Questions

  14. Pingback: burningrump

  15. I’m anxious to try this out and I’ve downloaded the source from GitHub but I’ve run into the problem that the EMapWin32 unit is nowhere to be found. I’m attempting this with Delphi 10.1 Berlin. Any thoughts?


  16. Thank you for such a rapid response Rodrigo. I’ll keep hacking away! Would this also be the missing file when I attempt to use the Updater.exe?

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 )

Google+ photo

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

Connecting to %s