Skip to content
  • Categories
  • Recent
  • Tags
  • Popular
  • World
  • Users
  • Groups
Skins
  • Light
  • Cerulean
  • Cosmo
  • Flatly
  • Journal
  • Litera
  • Lumen
  • Lux
  • Materia
  • Minty
  • Morph
  • Pulse
  • Sandstone
  • Simplex
  • Sketchy
  • Spacelab
  • United
  • Yeti
  • Zephyr
  • Dark
  • Cyborg
  • Darkly
  • Quartz
  • Slate
  • Solar
  • Superhero
  • Vapor

  • Default (No Skin)
  • No Skin
Collapse
Code Project
  1. Home
  2. General Programming
  3. C / C++ / MFC
  4. CFileDialog OnTypeChange issue

CFileDialog OnTypeChange issue

Scheduled Pinned Locked Moved C / C++ / MFC
helpquestion
1 Posts 1 Posters 0 Views 1 Watching
  • Oldest to Newest
  • Newest to Oldest
  • Most Votes
Reply
  • Reply as topic
Log in to reply
This topic has been deleted. Only users with topic management privileges can see it.
  • _ Offline
    _ Offline
    _Flaviu
    wrote on last edited by
    #1

    I derived a class from CFileDialog, named CFileDialogExt. I override OnTypeChange, just like this:

    void CFileDialogExt::OnTypeChange()
    {
    // TODO: Add your specialized code here and/or call the base class

    switch(GetOFN().nFilterIndex)
    {
    case 1:
    	SetDefExt(\_T("bmp"));
    	break;
    case 2:
    	SetDefExt(\_T("gif"));
    	break;
    case 3:
    	SetDefExt(\_T("jpg"));
    	break;
    case 4:
    	SetDefExt(\_T("png"));
    	break;
    case 5:
    	SetDefExt(\_T("tiff"));
    	break;
    }
    
    CFileDialog::OnTypeChange();
    

    }

    Default type is bmp. I type "aaa" as file name. I change the type (from combo type), as gif. The file name is still "aaa". I change again as jpg, the file name is changed as "aaa.gif" !! Is delayed by one changing ... strange ... why ? Furthermore, I change extension as tiff, the file name is "aaa.jpg", not "aaa.tiff" .... I have done wrong here ?

    1 Reply Last reply
    0
    Reply
    • Reply as topic
    Log in to reply
    • Oldest to Newest
    • Newest to Oldest
    • Most Votes


    • Login

    • Don't have an account? Register

    • Login or register to search.
    • First post
      Last post
    0
    • Categories
    • Recent
    • Tags
    • Popular
    • World
    • Users
    • Groups