fork download
  1. #include <vcl.h>
  2. #pragma hdrstop
  3.  
  4. #include "Unit1.h"
  5. #pragma package(smart_init)
  6. #pragma resource "*.dfm"
  7. TForm1 *Form1;
  8. bool __fastcall TForm1::Show(TComponent* cmp,const AnsiString &str)
  9. {
  10. TButton *btn = dynamic_cast<TButton*>(cmp);
  11. if(btn)
  12. {
  13. btn->Caption = str;
  14. return true;
  15. }
  16.  
  17. TMemo *memo = dynamic_cast<TMemo*>(cmp);
  18. if(memo)
  19. {
  20. memo->Text = str;
  21. return true;
  22. }
  23. return false;
  24. }
  25. __fastcall TForm1::TForm1(TComponent* Owner)
  26. : TForm(Owner)
  27. {
  28. const unsigned N = 3;
  29. AnsiString cmpName[N] = {"Button1","Button2","Memo1"};
  30. AnsiString cmpCH[N] = {"按鈕一","按鈕二","表一"};
  31. for(int i = 0 ; i < ComponentCount ; ++i)
  32. {
  33. for(unsigned j = 0 ; j < N ; ++j)
  34. {
  35. if(Components[i]->Name == cmpName[j])
  36. {
  37. Show(Components[i],cmpCH[j]);
  38. }
  39. }
  40. }
  41. }
  42.  
Compilation error #stdin compilation error #stdout 0s 0KB
stdin
Standard input is empty
compilation info
prog.cpp:1:17: fatal error: vcl.h: No such file or directory
compilation terminated.
stdout
Standard output is empty