选择标准MFC,想用该控件选择文件夹,结果浏览模式设为:
File Browse时可以正常使用;当设为:Folder Browse时却出现afxeditBrowse.cpp中550行的错误
即:
ENSURE(afxShellManager != NULL); // You need to call CWinAppEx::InitShellManager() first!
原因:
需要首先调用CWinAppEx::InitShellManager() ,而我的APP类都是继承自CWinApp,因此把CWinApp都改成CWinAppEx,然后在InitInstance中调用CWinAppEx::InitShellManager()
为何不能直接在CMyApp::InitInstance调用?因为CWinAppEx的基类为CWinApp
在CMyApp的函数实现中可以直接调用其基类和自身的函数,却不能调用其他类的函数,除非为友元函数或友元类。