Unitview.cpp
上传用户:cqslgg
上传日期:2009-12-10
资源大小:128k
文件大小:1k
源码类别:

Delphi/CppBuilder

开发平台:

C++ Builder

  1. //---------------------------------------------------------------------------
  2. #include <vcl.h>
  3. #pragma hdrstop
  4. #include "Unitcontrol.h"
  5. #include "Unitview.h"
  6. //---------------------------------------------------------------------------
  7. #pragma package(smart_init)
  8. #pragma resource "*.dfm"
  9. #pragma resource "bitmap.res"
  10. TFormView *FormView;
  11. //---------------------------------------------------------------------------
  12. __fastcall TFormView::TFormView(TComponent* Owner)
  13.         : TForm(Owner)
  14. {
  15. }
  16. //---------------------------------------------------------------------------
  17. void __fastcall TFormView::Timer1Timer(TObject *Sender)
  18. {
  19. int i ;
  20. randomize();
  21. i=rand()%2;
  22. if(i==0)
  23. i=-1;
  24. else
  25. i=1;
  26. Image1->Top=i*(rand()%this->Height);
  27. Image1->Left=i*(rand()%this->Width);
  28. }
  29. //---------------------------------------------------------------------------
  30. void __fastcall TFormView::FormCreate(TObject *Sender)
  31. {
  32.  AnsiString picdir="no";
  33.  int frequence=3;
  34.  TRegistry *Registry = new TRegistry;
  35.   try
  36.   {
  37.     Registry->RootKey =HKEY_CURRENT_USER;
  38.     if(Registry->KeyExists("\Software\CODEHUNTER")==false){
  39.     Registry->OpenKey("\Software\CODEHUNTER",true);
  40.     Registry->WriteString("PicDir",picdir);
  41.     Registry->WriteInteger("frequence",frequence);
  42.     Registry->CloseKey();
  43.     }
  44.   }
  45.   __finally
  46.   {
  47.     delete Registry;
  48.   }
  49. }
  50. //---------------------------------------------------------------------------