Click here to Skip to main content
16,020,182 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
See more:
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
Posted
Updated 24-Jan-10 12:36pm
v2

1 solution

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 );
 
Share this answer
 
v2

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900