Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations Mike Lewis on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

How to close SDI from a button?

Status
Not open for further replies.

HippoTas

Programmer
Dec 4, 2001
15
GR
I have an SDI app (derived from CFromView an I want to exit using a button.
I can do that from the menu (ID_APP_EXIT) or the status bar. I tried :

void CMyView::OnExit()
{
CFormView::OnClose();
}

but i didn't work
 
You can do it so:
void CMyView::OnExit()
{
ExitProcess( 0);
}

or so
void CMyView::OnExit()
{
GetParent( )->SendMessage( WM_CLOSE, (WPARAM) 0, (LPARAM) 0 );
}

or so:
void CMyView::OnExit()
{
AfxGetMainWnd()->SendMessage( WM_CLOSE, (WPARAM) 0, (LPARAM) 0 );
}
 
Thnx tchouch
I used this :

void CMyView::OnExit()
{
AfxGetApp()->CloseAllDocuments(TRUE);
}
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top