Cry about...
Delphi Troubleshooting

Project PPPP raised exception class EOleException with message 'Access is denied'


When running a project that uses the TWebBrowser component, which tries to extract information about a frame, the following error is generated:

Project PPPP raised exception class EOleException with message 'Access is denied'. Process topped. use Step or Run to continue.

where: 'PPPP' is the name of the Delphi project.


This error is caused by the security model that Microsoft built into the TWebBrowser component. The exception will be thrown if the frame shows a page from a different domain than the frameset.


There is no single remedy, but consider each of the following:

  1. Try catching the error. For example:
    for index := browserDocument.frames.length-1 downto 0 do
      oleIndex := index;
      frameDsp := browserDocument.frames.item(oleIndex);
      if Assigned(frameDsp) then
        frameWin := frameDsp as IHTMLWindow2;
        if Assigned(frameWin) then
            frameDoc := frameWin.Document;
          except on EOleException do
            frameDoc := nil;

    be aware that whilst this will allow you to define logic for handling the error in code, it will not stop Delphi from breaking execution of the application.

  2. To stop Delphi from breaking, you will need to configure Delphi to ignore the exception by telling it that the application will handle the exception. Go to Tools > Debugger Options, on the "Language Exceptions" tab add "EOleException". Ensure that it is ticked, which tells the Delphi environment to ignore the exception (and let the code run).

    It would be nice to be able to specify this at a module or unit level rather than globally, but I have yet to find a way of achieving this.

These notes are believed to be correct for Delphi 6 but may apply to other versions as well.

About the author: is a dedicated software developer and webmaster. For his day job he develops websites and desktop applications as well as providing IT services. He moonlights as a technical author and consultant.