2012-08-14 85 views
0

我嘗試退出應用程序(需要了解Visual C++程序的基本結構),但不接受MSDN的代碼。我究竟做錯了什麼?在Visual C++中退出應用程序

private: System::Void exitToolStripMenuItem_Click(System::Object^ sender, System::EventArgs^ e) 
{ 
} 
Application::Exit(); }; 

的錯誤是在運行此代碼: error C3254: 'Program::Form1' : class contains explicit override 'Exit' but does not derive from an interface that contains the function declaration
error C2838: 'Exit' : illegal qualified name in member declaration
error C4430: missing type specifier - int assumed. Note: C++ does not support default-int
warning C4183: 'Exit': missing return type; assumed to be a member function returning 'int'

我無法找到任何這有用的信息,今天是我第一天在VS 2008中嘗試

回答

4

我認爲Application :: Exit();是錯誤的。以下工作:

private: System::Void exitToolStripMenuItem_Click(System::Object^ sender, System::EventArgs^ e) { 
      Application::Exit(); } 
};