Недавно добавленные исходники

•  DeLiKaTeS Tetris (Тетрис)  171

•  TDictionary Custom Sort  3 343

•  Fast Watermark Sources  3 095

•  3D Designer  4 852

•  Sik Screen Capture  3 350

•  Patch Maker  3 556

•  Айболит (remote control)  3 665

•  ListBox Drag & Drop  3 018

•  Доска для игры Реверси  81 739

•  Графические эффекты  3 948

•  Рисование по маске  3 253

•  Перетаскивание изображений  2 633

•  Canvas Drawing  2 761

•  Рисование Луны  2 586

•  Поворот изображения  2 195

•  Рисование стержней  2 171

•  Paint on Shape  1 569

•  Генератор кроссвордов  2 240

•  Головоломка Paletto  1 769

•  Теорема Монжа об окружностях  2 237

•  Пазл Numbrix  1 685

•  Заборы и коммивояжеры  2 059

•  Игра HIP  1 282

•  Игра Go (Го)  1 230

•  Симулятор лифта  1 476

•  Программа укладки плитки  1 219

•  Генератор лабиринта  1 548

•  Проверка числового ввода  1 367

•  HEX View  1 497

•  Физический маятник  1 359

 
скрыть


Delphi FAQ - Часто задаваемые вопросы

| Базы данных | Графика и Игры | Интернет и Сети | Компоненты и Классы | Мультимедиа |
| ОС и Железо | Программа и Интерфейс | Рабочий стол | Синтаксис | Технологии | Файловая система |



Delphi Sources

Создать Системную Точку Восстановления (XP)



Оформил: DeeCo

{ 
  If you haven't installed the Microsoft Scripting Control yet 
  (TScriptControl component), 
  get it from http://www.msdn.microsoft.com/scripting/ 

  Once you've downloaded and run the installation, start Delphi and go to the 
  Component | Import ActiveX Control... menu. 
  Select "Microsoft Script Control 1.0" from the Listbox amd click "Install" 
  to install the component into Delphi's palette. 
  What you should end up with now is a TScriptControl component on your ActiveX tab. 
  Start a new application, and drop a TButton, and a TScriptControl onto the main form. 
  In the OnClick event of Button1, put the following code: 
}


 { 
  Wenn du das Microsoft Scripting Control noch nicht installiert hast 
  (Komponente TScriptControl), dann kannst du hier runterladen: 
  http://www.msdn.microsoft.com/scripting/ 

  Nachdem Herunterladen und der Installation wahle in der Delphi IDE unter dem 
  Menu "Komponente" den Menupunkt "ActiveX importieren". 
  Dann in der Listbox "Microsoft Script Control 1.0" auswahlen und "Installieren..." 
  anklicken. 
  Nun sollte die TScriptControl Komponente unter dem ActiveX Register zu finden sein. 
  Plaziere nun eine TScriptControl Komponente und einen TButton auf einer Form und 
  schreibe im OnClick Ereignis des Buttons den folgenden Code: 
}

 procedure TForm1.Button1Click(Sender: TObject);
 var
   sr: OLEVAriant;
 begin
   ScriptControl1.Language := 'VBScript';
   sr := ScriptControl1.Eval('getobject("winmgmts:\\.\root\default:Systemrestore")');
   if sr.CreateRestorePoint('Automatic Restore Point', 0, 100) = 0 then
     ShowMessage('New Restore Point successfully created.')
     // Wiederherstellungspunkt erfolgreich erstellt 
  else
     ShowMessage('Restore Point creation Failed!');
     // Wiederherstellungspunkt Erstellung fehlgeschlagen. 
end;



 {*****************************************************}

 {2. Using the SRSetRestorePoint() API from SrClient.dll}

 // Translation from SRRestorePtAPI.h 
const
  // Type of Event 
 BEGIN_SYSTEM_CHANGE = 100;
  END_SYSTEM_CHANGE  = 101;
  // Type of Restore Points 
 APPLICATION_INSTALL =  0;
  CANCELLED_OPERATION = 13;
  MAX_DESC = 64;
  MIN_EVENT = 100;

 // Restore point information 
type
 PRESTOREPTINFOA = ^_RESTOREPTINFOA;
 _RESTOREPTINFOA = packed record
     dwEventType: DWORD;  // Type of Event - Begin or End 
    dwRestorePtType: DWORD;  // Type of Restore Point - App install/uninstall 
    llSequenceNumber: INT64;  // Sequence Number - 0 for begin 
    szDescription: array [0..MAX_DESC] of CHAR; // Description - Name of Application / Operation 
end;
 RESTOREPOINTINFO = _RESTOREPTINFOA;
 PRESTOREPOINTINFOA = ^_RESTOREPTINFOA;

 // Status returned by System Restore 

PSMGRSTATUS = ^_SMGRSTATUS;
 _SMGRSTATUS = packed record
     nStatus: DWORD; // Status returned by State Manager Process 
    llSequenceNumber: INT64;  // Sequence Number for the restore point 
end;
 STATEMGRSTATUS =  _SMGRSTATUS;
 PSTATEMGRSTATUS =  ^_SMGRSTATUS;

 function SRSetRestorePointA(pRestorePtSpec: PRESTOREPOINTINFOA; pSMgrStatus: PSTATEMGRSTATUS): Bool;
   stdcall; external 'SrClient.dll' Name 'SRSetRestorePointA';

 // Example how to create and cancel a previous restore point. 
// Ref: http://tinyurl.com/78pv 

procedure TForm1.Button1Click(Sender: TObject);
 const
  CR = #13#10;
var
  RestorePtSpec: RESTOREPOINTINFO;
   SMgrStatus: STATEMGRSTATUS;
 begin
   // Initialize the RESTOREPOINTINFO structure 
  RestorePtSpec.dwEventType := BEGIN_SYSTEM_CHANGE;
   RestorePtSpec.dwRestorePtType := APPLICATION_INSTALL;
   RestorePtSpec.llSequenceNumber := 0;
   RestorePtSpec.szDescription := 'SAMPLE RESTORE POINT';

   if (SRSetRestorePointA(@RestorePtSpec, @SMgrStatus)) then
   begin
     ShowMessage('Restore point set. Restore point data:' + CR+
       'Sequence Number: ' + Format('%d', [SMgrStatus.llSequenceNumber]) + CR+
       'Status: ' + Format('%u', [SMgrStatus.nStatus]));

       // Restore Point Spec to cancel the previous restore point. 
      RestorePtSpec.dwEventType := END_SYSTEM_CHANGE;
       RestorePtSpec.dwRestorePtType  := CANCELLED_OPERATION;
       RestorePtSpec.llSequenceNumber := SMgrStatus.llSequenceNumber;

       // This is the sequence number returned by the previous call. 
      // Canceling the previous restore point 
      if (SRSetRestorePointA(@RestorePtSpec, @SMgrStatus)) then
         ShowMessage('Restore point canceled. Restore point data:' + CR+
         'Sequence Number: ' + Format('%d', [SMgrStatus.llSequenceNumber]) + CR+
         'Status: ' + Format('%u', [SMgrStatus.nStatus]))

       else
         ShowMessage('Couldn''t cancel restore point.');
     end
     else
       ShowMessage('Couldn''t set restore point.');
   end;
 end;







Copyright © 2004-2024 "Delphi Sources" by BrokenByte Software. Delphi World FAQ

Группа ВКонтакте