0

I want to disable the cancel button in CFiledialog.

How can I do it?

Is there any way other than creating a new one using Cdialog?

ds kim
  • 1
  • 2
    Why would you want to do this? – 1201ProgramAlarm May 27 '20 at 03:31
  • [EnableWindow](https://learn.microsoft.com/en-us/windows/win32/api/winuser/nf-winuser-enablewindow) can disable mouse and keyboard input. Handling [WM_GETDLGCODE](https://learn.microsoft.com/en-us/windows/win32/dlgbox/wm-getdlgcode) allows you to intercept the ESC key. [Other tricks with WM_GETDLGCODE](https://devblogs.microsoft.com/oldnewthing/20031126-00/?p=41703) explains how. – IInspectable May 27 '20 at 06:10
  • Something along the lines of `GetDlgItem(IDCANCEL)->EnableWindow(FALSE)`. – Andrew Truckle May 27 '20 at 08:59
  • hi @AndrewTruckle. How can I get Cfiledialog's IDCANCEL? – ds kim May 28 '20 at 01:56
  • When I Googled your question it said: dialogvar.GetParent()->GetDlgItem(IDCANCEL)-m ... I have not tested this. – Andrew Truckle May 28 '20 at 03:45
  • The [explorer-style control identifiers](https://learn.microsoft.com/en-us/windows/win32/dlgbox/open-and-save-as-dialog-boxes#explorer-style-control-identifiers) are documented. That still leaves the question: What, if a user confused by the inability to click cancel simply closes the dialog? – IInspectable May 31 '20 at 06:58

0 Answers0