SearchDirectory(...) crashes in child but not parent !!!

Discussion in 'MFC' started by Setzer, Mar 23, 2012.

  1. Setzer

    Setzer New Member

    Joined:
    Mar 23, 2012
    Messages:
    3
    Likes Received:
    0
    Trophy Points:
    0
    Hi, I have an MFC dialog project. I have a general function (without a class) that I have been using to search a directory for a certain file. This function works fine with my parent dialog. Whenever I try to use it with a modal child dialog it crashes at
    Code:
    return::CallWindowProc(m_pfnSuper, m_hWnd, nMsg, wParam, lParam);
    This is the declaration of the function:
    Code:
    int SearchDirectory(std::vector<std::string> &refvecFiles,
                        const std::string        &refcstrRootDirectory,
                        const std::string        &refcstrExtension,
                        bool                     bSearchSubdirectories );
    Please help !!! Thank you :)
     
  2. Setzer

    Setzer New Member

    Joined:
    Mar 23, 2012
    Messages:
    3
    Likes Received:
    0
    Trophy Points:
    0
    In case anyone is ever curious I solved this by putting SearchDirectory into the parent's class then created a friend function in the child class.

    Still think this was strange...
     
  3. Setzer

    Setzer New Member

    Joined:
    Mar 23, 2012
    Messages:
    3
    Likes Received:
    0
    Trophy Points:
    0
    Ok disregard that last post. The problem is not fixed. I didn't realize that when I tested it there was no file in the directory so it returned without an issue. When it does find a file and tries to return a vector of that file it fails spectacularly
     

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