Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 706223
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 14, 20262026-05-14T04:08:32+00:00 2026-05-14T04:08:32+00:00

In Delphi 2007 and later, the global variable UseLatestCommonDialogs causes TOpenDialog to use the

  • 0

In Delphi 2007 and later, the global variable UseLatestCommonDialogs causes TOpenDialog to use the new Vista-style dialog on Windows Vista and 7. That’s cool.

Unfortunately, the Vista-style dialog does not seem to support the ofHideReadOnly option of TOpenDialog. The read-only checkbox never appears regardless whether this option is set to True or False.

How can I make TOpenDialog show a read-only checkbox on the Vista-style dialog?

Since this breaks backwards compatibility, I’ve reported this as a bug: QC 83606 A Delphi 2006 application that had ofHideReadOnly set to False will lose its read only checkbox when compiled without changes with Delphi 2007, 2009, or 2010 and run on Windows Vista or 7.

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-05-14T04:08:32+00:00Added an answer on May 14, 2026 at 4:08 am

    I’ve managed to implement this in Delphi 2010 by modifying Dialogs.pas as follows:

    First, declare and implement the class TFileOpenDialogWrapperReadOnlyEvent:

    { TFileOpenDialogWrapperReadOnlyEvent }
    
    type
      TFileOpenDialogWrapperReadOnlyEvent = class(TInterfacedObject, IFileDialogEvents, IFileDialogControlEvents)
      private
        FOpenDialog: TOpenDialog;
      public
        function OnButtonClicked(const pfdc: IFileDialogCustomize; dwIDCtl: Cardinal): HRESULT; stdcall;
        function OnCheckButtonToggled(const pfdc: IFileDialogCustomize; dwIDCtl: Cardinal; bChecked: LongBool): HRESULT; stdcall;
        function OnControlActivating(const pfdc: IFileDialogCustomize; dwIDCtl: Cardinal): HRESULT; stdcall;
        function OnItemSelected(const pfdc: IFileDialogCustomize; dwIDCtl: Cardinal; dwIDItem: Cardinal): HRESULT; stdcall;
        function OnFileOk(const pfd: IFileDialog): HRESULT; stdcall;
        function OnFolderChange(const pfd: IFileDialog): HRESULT; stdcall;
        function OnFolderChanging(const pfd: IFileDialog; const psiFolder: IShellItem): HRESULT; stdcall;
        function OnOverwrite(const pfd: IFileDialog; const psi: IShellItem; out pResponse: Cardinal): HRESULT; stdcall;
        function OnSelectionChange(const pfd: IFileDialog): HRESULT; stdcall;
        function OnShareViolation(const pfd: IFileDialog; const psi: IShellItem; out pResponse: Cardinal): HRESULT; stdcall;
        function OnTypeChange(const pfd: IFileDialog): HRESULT; stdcall;
      end;
    
    function TFileOpenDialogWrapperReadOnlyEvent.OnButtonClicked(const pfdc: IFileDialogCustomize; dwIDCtl: Cardinal): HRESULT;
    begin
      Result := S_OK
    end;
    
    function TFileOpenDialogWrapperReadOnlyEvent.OnCheckButtonToggled(const pfdc: IFileDialogCustomize; dwIDCtl: Cardinal; bChecked: LongBool): HRESULT;
    begin
      if bChecked then FOpenDialog.Options := FOpenDialog.Options + [ofReadOnly]
        else FOpenDialog.Options := FOpenDialog.Options - [ofReadOnly];
      Result := S_OK
    end;
    
    function TFileOpenDialogWrapperReadOnlyEvent.OnControlActivating(const pfdc: IFileDialogCustomize; dwIDCtl: Cardinal): HRESULT;
    begin
      Result := S_OK
    end;
    
    function TFileOpenDialogWrapperReadOnlyEvent.OnFileOk(const pfd: IFileDialog): HRESULT;
    begin
      Result := S_OK
    end;
    
    function TFileOpenDialogWrapperReadOnlyEvent.OnFolderChange(const pfd: IFileDialog): HRESULT;
    begin
      Result := S_OK
    end;
    
    function TFileOpenDialogWrapperReadOnlyEvent.OnFolderChanging(const pfd: IFileDialog; const psiFolder: IShellItem): HRESULT;
    begin
      Result := S_OK
    end;
    
    function TFileOpenDialogWrapperReadOnlyEvent.OnItemSelected(const pfdc: IFileDialogCustomize; dwIDCtl, dwIDItem: Cardinal): HRESULT;
    begin
      Result := S_OK
    end;
    
    function TFileOpenDialogWrapperReadOnlyEvent.OnOverwrite(const pfd: IFileDialog; const psi: IShellItem; out pResponse: Cardinal): HRESULT;
    begin
      Result := S_OK
    end;
    
    function TFileOpenDialogWrapperReadOnlyEvent.OnSelectionChange(const pfd: IFileDialog): HRESULT;
    begin
      Result := S_OK
    end;
    
    function TFileOpenDialogWrapperReadOnlyEvent.OnShareViolation(const pfd: IFileDialog; const psi: IShellItem; out pResponse: Cardinal): HRESULT;
    begin
      Result := S_OK
    end;
    
    function TFileOpenDialogWrapperReadOnlyEvent.OnTypeChange(const pfd: IFileDialog): HRESULT;
    begin
      Result := S_OK
    end;
    

    Declare this string as a resource so it can be localized (if you care about that):

    resourcestring
      SReadOnly = 'Read only';
    

    Then modify TFileOpenDialogWrapper.OnExecuteEvent in two steps. First, add these variable declarations:

    C: IFileDialogCustomize;
    E: TFileOpenDialogWrapperReadOnlyEvent;
    Cookie: Cardinal;
    

    Then add this code at the end of the procedure:

    if not (ofHideReadOnly in FOpenDialog.Options) then begin
      if FFileDialog.Dialog.QueryInterface(IFileDialogCustomize, C) = S_OK then begin
        C.AddCheckButton(1, PChar(SReadOnly), ofReadOnly in FOpenDialog.Options);
        E := TFileOpenDialogWrapperReadOnlyEvent.Create;
        E.FOpenDialog := FOpenDialog;
        FFileDialog.Dialog.Advise(E, Cookie);
      end;
    end;
    

    Copy the new Dialogs.pas to your source code folder and delete or rename the two Dialogs.dcu files in Delphi’s Lib folder. Recompile your app an ofHideReadOnly will work with Vista-style dialogs.

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I have a Windows CGI created with Delphi 2007 using CGIExpert that I need
I made an OCX with Delphi 2007. Now my customer claims that there is
Does that mean that I can't share a Form between delphi 2007 and 2009?
Is it possible to use a .NET DLL in Delphi 2007 for Win32? I've
I'm using Delphi 2007 Pro. I have a runtime package that includes a number
After upgrading to Windows 7 all seems to work in my Delphi 2007 version
Every time I try compile a VB project that uses a Delphi (2007) activex,
Can I use Delphi 2007 to communicate with a WCF service using the netnamedpipebinding
In Delphi 2007, in a mouse move event, I try to change the mouse
I'm using Delphi 2007. How can I put a GIF/PNG image on a BitBtn

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.