从DLL调用时的CFileDialog问题 [英] CFileDialog problem when called from DLL
问题描述
在MFC dll中,我有一个带有以下功能的按钮的对话框:按下该按钮会生成一个CFileDialog对象。为此对象运行DoModal假设打开打开/保存对话框。不幸的是,当它获得
到DoModal部分时(应用程序挂起)没有任何反应。我没有任何访问违规行为。调试并没有清除什么使应用程序挂起,但它确实挂在MFC的filedlg.cpp内。当我从客户端应用程序内部调用文件对话框时它工作正常(.exe
文件)
有人可以帮忙吗?
Inside the MFC dll I have a dialog with a button with the following function: pressing the button generates a CFileDialog object. Running DoModal for this object is suppose to bring up the Open/Save Dialog Box. Unfortunately, nothing happens when it gets
to DoModal part (the app hangs). I do not get any access violations. And the debug does not clear up what makes the app hangs, but it does hang somewhere inside the MFC's filedlg.cpp. It works fine when i call the file dialog from inside the client app (.exe
file)
Can anybody help?
谢谢。
// In the Button
CFileDialog FileDlg(TRUE, ".txt", NULL, OFN_NOCHANGEDIR, strFilter);
if( FileDlg.DoModal() == IDOK )
{
...
}
推荐答案
代码片段你发布的是来自MFC DLL应用程序,对吧? DLL无法单独运行。它应该由其他应用程序调用。
the code snippets you posted is from the MFC DLL application, right? The DLL cannot run alone. it should be called by other application.
如果你在你身边运行dll,那么对话框就不会出现了,
it is nomal that the dialog do not appear if you run the dll on you side,
这篇关于从DLL调用时的CFileDialog问题的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!