Unit1.cpp
上传用户:lhxd_sz
上传日期:2014-10-02
资源大小:38814k
文件大小:2k
- //---------------------------------------------------------------------------
- #include <vcl.h>
- #pragma hdrstop
- #include "Unit1.h"
- #include "Unit2.h"
- #include "Unit3.h"
- //---------------------------------------------------------------------------
- #pragma package(smart_init)
- #pragma resource "*.dfm"
- TForm1 *Form1;
- //---------------------------------------------------------------------------
- __fastcall TForm1::TForm1(TComponent* Owner)
- : TForm(Owner)
- {
- }
- //---------------------------------------------------------------------------
- void __fastcall TForm1::Button1Click(TObject *Sender)
- {
- int ii;
- for(ii=0;ii<Application->ComponentCount;ii++)
- {
- ShowMessage(Application->Components[ii]->ClassName());
- }
- }
- //---------------------------------------------------------------------------
- void __fastcall TForm1::Button2Click(TObject *Sender)
- {
- TForm *fm;
- AnsiString ass,mss;
- int ii;
- mss=Application->MainForm->Name;
- ii=0;
- for(;;)
- {
- if(ii>=Application->ComponentCount)break;
- ass=Application->Components[ii]->Name;
- if((ass!=mss)&&(ass!=""))
- {
- ShowMessage(ass);
- fm=(TForm *)Application->Components[ii];
- delete fm;
- }
- else
- ii++;
- }
- }
- //---------------------------------------------------------------------------
- void __fastcall TForm1::Button3Click(TObject *Sender)
- {
- Form2->Show();
- }
- //---------------------------------------------------------------------------
- void __fastcall TForm1::Button4Click(TObject *Sender)
- {
- Form3->Show();
- }
- //---------------------------------------------------------------------------
- void __fastcall TForm1::Button5Click(TObject *Sender)
- {
- try
- {
- Form2->Show();
- }
- catch(...)
- {
- Application->CreateForm(__classid(TForm2), &Form2);
- Form2->Show();
- }
- }
- //---------------------------------------------------------------------------
- void __fastcall TForm1::Button6Click(TObject *Sender)
- {
- try
- {
- Form3->Show();
- }
- catch(...)
- {
- Application->CreateForm(__classid(TForm3), &Form3);
- Form3->Show();
- }
- }
- //---------------------------------------------------------------------------