Win32 GetOpenFileName 阻止应用程序退出
我使用 Win32 和 C++ 来制作一个应用程序,可以通过带有 GetOpenFileName 函数的对话框加载文件内容。一切工作正常,除了当我关闭主窗口并且应用程序退出并将其打印到控制台时:
线程“Win32 Thread”(0xa50) 已退出,代码为 0 (0x0)。
进程继续运行,我必须在 Visual Studio 中显式终止它 任务管理器,我得到以下输出:
The program '[2620] DBSCAN.exe: Native' has exited with code -1073741510 (0xc000013a).
GetOpenFileName 是否创建了一个我必须的新线程终止我自己?我已经检查了msdn和一些教程,我似乎没有做任何与标准用法不同的事情,打开文件,读取内容,关闭文件。
如果需要,我可以发布一些代码,欢迎任何帮助。
谢谢
I'm using Win32 with C++ to make an app that can load the contents of files through a dialog with the GetOpenFileName function. Everything works fine, except when I close the main window and the app quits and prints this to the console:
The thread 'Win32 Thread' (0xa50) has exited with code 0 (0x0).
But the main process keeps running and I have to kill it explicitly in Visual Studio of
the task manager, and I get this output:
The program '[2620] DBSCAN.exe: Native' has exited with code -1073741510 (0xc000013a).
Does the GetOpenFileName create a new thread that I have to terminate myself ? I've checked out the msdn and a few tutorials, I don't seem to be doing anything different than the standard usage, open a file, read content, close file.
I can post some code if needed, any help would be welcome.
Thanks
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
尝试不设置所有者( ofnflags.hwndOwner = NULL )。
如果您确实设置了所有者,则出现的窗口将作为所有者的子窗口进行线程化,这反过来会导致您所描述的行为。
try not setting an owner( ofnflags.hwndOwner = NULL ).
if you do set an owner, the occurring window will be threaded as a child window of the owner, which in turn would result in the behavior you are describing.