Unit1.cpp
Upload User: lhxd_sz
Upload Date: 2014-10-02
Package Size: 38814k
Code Size: 1k
Development Platform:

C++ Builder

  1. //---------------------------------------------------------------------------
  2. #include <vcl.h>
  3. #pragma hdrstop
  4. #include "Unit1.h"
  5. //---------------------------------------------------------------------------
  6. #pragma package(smart_init)
  7. #pragma resource "*.dfm"
  8. TForm1 *Form1;
  9. //---------------------------------------------------------------------------
  10. __fastcall TForm1::TForm1(TComponent* Owner)
  11.         : TForm(Owner)
  12. {
  13. }
  14. //---------------------------------------------------------------------------
  15. void __fastcall TForm1::DeleteSelfExec(void)
  16. {
  17.   AnsiString ass;
  18.   TFileStream *sm;
  19.   sm=new TFileStream("UnInstmp.bat",fmCreate);
  20.   ass="del "+ExtractFileName(Application->ExeName)+"rn";
  21.   sm->Write(ass.c_str(),ass.Length());
  22.   ass="del %0rn";
  23.   sm->Write(ass.c_str(),ass.Length());
  24.   delete sm;
  25.   WinExec("UnInstmp.bat",SW_HIDE);
  26. }
  27. //---------------------------------------------------------------------------
  28. void __fastcall TForm1::Button1Click(TObject *Sender)
  29. {
  30.   Close();
  31.   DeleteSelfExec();
  32. }
  33. //---------------------------------------------------------------------------