创建一个系统返回点(XP)

  • 主题发起人 主题发起人 import
  • 开始时间 开始时间
I

import

Unregistered / Unconfirmed
GUEST, unregistred user!
...create a System Restore point (XP)? Author: Thomas Stutz
Homepage: http://www.swissdelphicenter.com
{
If you haven't installed the Microsoft Scripting Control yet
(TScriptControl component),
download 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:
}
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.')
else
ShowMessage('Restore Point creation Failed!');
end;
 

Similar threads

A
回复
0
查看
943
Andreas Hausladen
A
A
回复
0
查看
819
Andreas Hausladen
A
后退
顶部