在Visual C++中退出应用程序

fee*_*all 0 exit visual-studio-2008

我尝试退出一个应用程序(需要知道Visual C++程序的基本结构),但不接受MSDN的代码.我究竟做错了什么?

private: System::Void exitToolStripMenuItem_Click(System::Object^  sender, System::EventArgs^  e)
{
}
 Application::Exit(); };
Run Code Online (Sandbox Code Playgroud)

运行此代码时出错: 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中尝试的第一天.

rol*_*rer 5

我认为Application :: Exit(); 是错误的.以下工作如下:

private: System::Void exitToolStripMenuItem_Click(System::Object^ sender, System::EventArgs^ e) {
          Application::Exit(); }
};
Run Code Online (Sandbox Code Playgroud)