Providing a custom template for CFileDialog

Discussion in 'MFC' started by shabbir, Nov 8, 2006.

  1. shabbir

    shabbir Administrator Staff Member

    Joined:
    Jul 12, 2004
    Messages:
    15,375
    Likes Received:
    388
    Trophy Points:
    83
    1. Add a New class derived from CFileDialog

    2. Add a dialog that will be the template to your File dialog.

    3. Change the Style of the Dialog so that it does not have any border/Control Box and add the Clip Siblings property to checked.

    4. Now in the constructor of your class OFN_ENABLETEMPLATE as a flag indicating that you will be using the custom template.

    5. Now specify the template name in the m_ofn. m_ofn.lpTemplateName = MAKEINTRESOURCE(IDD_FILE_DIALOG);

    Your template is repositioned and resized to fit the standard controls when the CFileDialog window is first created.

    If you want precise positioning of the standard controls, you can place a static control with an ID of stc32 on your template to indicate where you want the standard controls (Folder Combo , File Chooser and some navigation buttons like back, up ...) to be placed.
     
  2. elec.shabnam

    elec.shabnam New Member

    Joined:
    Feb 13, 2008
    Messages:
    102
    Likes Received:
    0
    Trophy Points:
    0
    this is a real nice way of providing custom tempalate
     
  3. aisha.ansari84

    aisha.ansari84 New Member

    Joined:
    Feb 13, 2008
    Messages:
    82
    Likes Received:
    1
    Trophy Points:
    0
    :iagree:
     
  4. debleena_doll2002

    debleena_doll2002 New Member

    Joined:
    Feb 5, 2008
    Messages:
    119
    Likes Received:
    0
    Trophy Points:
    0
  5. parvez.yu

    parvez.yu New Member

    Joined:
    Feb 14, 2008
    Messages:
    100
    Likes Received:
    0
    Trophy Points:
    0

Share This Page

  1. This site uses cookies to help personalise content, tailor your experience and to keep you logged in if you register.
    By continuing to use this site, you are consenting to our use of cookies.
    Dismiss Notice