终止SDI应用程序. [英] Terminating an SDI application.

查看:62
本文介绍了终止SDI应用程序.的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我正在构建一个SDI应用程序,在该应用程序中进行测试以查看设备是否已连接到USB端口.如果是这样,我将继续我的应用程序.如果不是,我想终止该应用程序.

如何在SDI环境中终止应用程序?

我知道我可以在TheApp实例中返回FALSE,但是我真的很想从我的Document或View类中做到这一点.

提前谢谢.

Steve

I am building an SDI application where I am testing to see if a device is connected to a USB port. If it is, I continue with my app. If it isn''t, I want to terminate the app.

How do I terminate an app within the SDI environment?

I know I can return FALSE in my TheApp Instance, but I really want to do it from my Document or View class.

Thanks in advance.

Steve

推荐答案

您何时/何地进行测试?

如果它在您应用的InitInstance()函数中,则返回FALSE即可.

如果您不是从应用程序的InitInstance()中执行此操作,那么我相信您想要其中一个:

AfxGetMainWnd()-> PostMessage(WM_CLOSE,0,0);



AfxGetMainWnd()-> SendMessage(WM_CLOSE,0,0);
When/where are you doing the testing?

If it is in your app''s InitInstance() function, then returning FALSE should do it.

If you are not doing this from the app''s InitInstance(), then I believe you want either:

AfxGetMainWnd()->PostMessage( WM_CLOSE, 0, 0 );

or

AfxGetMainWnd()->SendMessage( WM_CLOSE, 0, 0 );


这篇关于终止SDI应用程序.的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆