Using Common File Dialogs as Modeless Views

Environment: VC6 SP3, NT4 SP5, Windows 98, MSIE 5.0

This application was implemented for exercise purposes only. However I hope that ideas enclosed in it can be useful since it is sometimes required to get a Common Dialog modeless. Each Common File Dialog window has its style changed during creation and then lives in its own thread (CThreadRunningDlg class). The class for starting threads and wrapping of these dialog windows in the creation thread is CChildView. CdlgFileBrowse class is a descendant of standard MFC CFileDialog class running in its own thread. It implements actual initialization of parent Common File Dialog window. Common File Dialog window is sub-classed to maintain file list size fit under NT (CWndFileBrowse class). Of partial interest are also: splitter which allows maximally two panes opened and toggles windows tiling between horizontal and vertical (CTwixSplitter class) and edit bar derived from CControlBar class (CEditBar class).

Downloads

Download demo project - 9 Kb
Download source - 24 Kb


Comments

  • Added fix for improved draw performance

    Posted by Legacy on 10/24/2003 12:00am

    Originally posted by: Gareth

    What a great article! I have a small fix though...

    BOOL CDlgFileBrowse::OnInitDialog()
    {
    CWnd* pParent = GetParent();

    VERIFY(::SetWindowLong(*pParent, GWL_STYLE, WS_CHILD | WS_CLIPCHILDREN));

    ...I've added the WS_CLIPCHILDREN. You'll notice this will fix any werid painting problems when passing other windows over the file dialog. Great article though...

    g :�)

    Reply
  • Nice. But is it possible to do it in a CPropertyPage instead?

    Posted by Legacy on 07/17/2003 12:00am

    Originally posted by: Tomas Rasmussen

    Very nice application. But I would like it to appear in a CPropertyPage instead. Anyone able to solve that one???

    Best regards

    Tomas Rasmussen

    Reply
  • Two panes

    Posted by Legacy on 05/12/2003 12:00am

    Originally posted by: Dragan M

    Select more than 15 files. Press Enter. File Open dlg is gone.

    Reply
  • Very cool--anyone know how to do this in .Net (C#)?

    Posted by Legacy on 07/09/2002 12:00am

    Originally posted by: Scott

    Very good job on this...do you know how to do the same thing in C#? I want to put a file open dialog on a tab page. Any ideas?
    Thanks for the great work!

    Reply
  • Not Bad

    Posted by Legacy on 06/14/2001 12:00am

    Originally posted by: Jim.Rong

    Not Bad!

    Reply
  • Neat, but could be better commented

    Posted by Legacy on 06/11/2001 12:00am

    Originally posted by: JohnE

    First impressions.... Nice little app with some useful concepts. Does what it says on the tin, but (and it's only a minor but)... would it have hurt to sprinkle a few more comments here & there?

    Reply
Leave a Comment
  • Your email address will not be published. All fields are required.

Top White Papers and Webcasts

  • As all sorts of data becomes available for storage, analysis and retrieval - so called 'Big Data' - there are potentially huge benefits, but equally huge challenges...
  • The agile organization needs knowledge to act on, quickly and effectively. Though many organizations are clamouring for "Big Data", not nearly as many know what to do with it...
  • Cloud-based integration solutions can be confusing. Adding to the confusion are the multiple ways IT departments can deliver such integration...

Most Popular Programming Stories

More for Developers

RSS Feeds

Thanks for your registration, follow us on our social networks to keep up-to-date