windows窗体应用程序中并不会自动生成formclosed响应代码,需要自己注册:
this->Closed += gcnew System::EventHandler(this, &Form1::Form1_Closed);
private: System::Void Form1_Closed(System::Object^ sender, System::EventArgs^ e);
并在Form1.cpp中加入
System::Void Form1::Form1_Closed(System::Object^ sender, System::EventArgs^ e){}
再向其中加入事件响应代码。