dword Tapplication::Close() { // Close all open pages starting from the topmost while ( pageCount ) { Page* page = pageStack[pageCount-1]; page->Close(); } // flag that we're exiting m_isClosing = true; return 0; }