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. CMFCEditBrowseCtrl issue

CMFCEditBrowseCtrl issue

Scheduled Pinned Locked Moved C / C++ / MFC
helpwindows-adminalgorithmsquestionannouncement
1 Posts 1 Posters 2 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.
  • D Offline
    D Offline
    David Crow
    wrote on last edited by
    #1

    I've got a dialog app that uses several CMFCEditBrowseCtrl controls. For each, I've called the EnableFileBrowseButton() method. The issue I'm having is that I want to set an initial directory depending on which control is used. This is similar to the lpstrInitialDir member of OPENFILENAME. The problem is that CMFCEditBrowseCtrl has no such functionality. I tried deriving my own class from CMFCEditBrowseCtrl, overriding the OnBrowse() method, and calling SetCurrentDirectory() before calling the base class version. No luck. Yes, the CWD is indeed changed, but that is not what the internals of OnBrowse() is using. Each time the browse button is clicked, the initial directory is whatever was previously used. Thinking it may be storing something in the registry, I created a very oddly-named directory, ran the program, selected several of the browse buttons (each time opening to that oddly-named directory), and then exited. Searching the entire registry for that directory name came up empty. Any idea(s) as to what may be going on? <edit> Drilling down a bit further, the issue is with the CFileDialog object that OnBrowse() creates and how it uses OPENFILENAME. The solution was to simply copy the OnBrowse() code into my overridden version, and assign a value to dlg.m_ofn.lpstrInitialDir before DoModal() is called. </edit> Thanks. DC

    "One man's wage rise is another man's price increase." - Harold Wilson

    "Fireproof doesn't mean the fire will never come. It means when the fire comes that you will be able to withstand it." - Michael Simmons

    "You can easily judge the character of a man by how he treats those who can do nothing for him." - James D. Miles

    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