下 下雨了 Unregistered / Unconfirmed GUEST, unregistred user! 2007-05-21 #1 小弟,想读取xp中自己创建的用于系统还原的系统检查点,读出后显示在listview中,请大虾们赐教,谢谢
K kcahcn Unregistered / Unconfirmed GUEST, unregistred user! 2007-05-24 #3 参考 <br>http://msdn2.microsoft.com/en-us/library/aa378986.aspx<br>http://msdn2.microsoft.com/en-us/library/aa378951.aspx 这儿有vbscript的例子<br>如果要在delphi用那个vbscript就看下面这些步骤:<br>1)安装Windows Script Control:<br>下载Windows Script Control之后要安装,然后按activex control的安装方法在delphi安装。<br>可以看这个网址:<br>http://www.malcolmgroves.com/stories/2004/09/23/scriptingYourDelphiApplications.html<br>Windows Script Control下载地址<br>http://download.microsoft.com/download/winscript56/Install/1.0/W982KMeXP/EN-US/sct10en.exe <br>2)新建一个工程,加ScriptControl1,Memo1,Button1.<br>设置ScriptControl1的Language属性为'vbscript'<br>然后加这个代码<br>---<br>const<br> restorepointsscript:string=<br>'function SysRestorePoint(i)'+#13#10+<br>'Set RPSet = GetObject("winmgmts:root/default".InstancesOf ("SystemRestore"'+#13#10+<br>'for each RP in RPSet' +#13#10+<br> 's=s& "Dir: RP" & RP.SequenceNumber & ", Name: " & RP.Description & ", Type: "&RP.RestorePointType & ",Time: " & RP.CreationTime&vbnewline'+#13#10+<br>'next'+#13#10+<br>'SysRestorePoint=s'+#13#10+<br>'end function';<br>---<br>uses<br> ActiveX;<br>---<br>procedure TForm1.Button1Click(Sender: TObject);<br>var<br> Params : PSafeArray;<br> v : Variant;<br>begin<br> v := VarArrayCreate([0, 0], varVariant);<br> v[0] := 0; // parameter passed to function<br><br> Params := PSafeArray(TVarData(v).VArray);<br> ScriptControl1.AddCode(restorepointsscript);<br> Memo1.lines.add( ScriptControl1.Run('SysRestorePoint', Params));<br><br>end;<br>---<br>procedure TForm1.FormShow(Sender: TObject);<br>begin<br> ScriptControl1.SitehWnd := Self.Handle;<br>end;<br>---<br><br>结果会在Memo1显示。至于怎么显示,在哪儿显示你自己改<br>--------<br>Scripting Your Delphi Applications 附加几个例子可以参考一下<br><br>Kind regards,<br>cipher
参考 <br>http://msdn2.microsoft.com/en-us/library/aa378986.aspx<br>http://msdn2.microsoft.com/en-us/library/aa378951.aspx 这儿有vbscript的例子<br>如果要在delphi用那个vbscript就看下面这些步骤:<br>1)安装Windows Script Control:<br>下载Windows Script Control之后要安装,然后按activex control的安装方法在delphi安装。<br>可以看这个网址:<br>http://www.malcolmgroves.com/stories/2004/09/23/scriptingYourDelphiApplications.html<br>Windows Script Control下载地址<br>http://download.microsoft.com/download/winscript56/Install/1.0/W982KMeXP/EN-US/sct10en.exe <br>2)新建一个工程,加ScriptControl1,Memo1,Button1.<br>设置ScriptControl1的Language属性为'vbscript'<br>然后加这个代码<br>---<br>const<br> restorepointsscript:string=<br>'function SysRestorePoint(i)'+#13#10+<br>'Set RPSet = GetObject("winmgmts:root/default".InstancesOf ("SystemRestore"'+#13#10+<br>'for each RP in RPSet' +#13#10+<br> 's=s& "Dir: RP" & RP.SequenceNumber & ", Name: " & RP.Description & ", Type: "&RP.RestorePointType & ",Time: " & RP.CreationTime&vbnewline'+#13#10+<br>'next'+#13#10+<br>'SysRestorePoint=s'+#13#10+<br>'end function';<br>---<br>uses<br> ActiveX;<br>---<br>procedure TForm1.Button1Click(Sender: TObject);<br>var<br> Params : PSafeArray;<br> v : Variant;<br>begin<br> v := VarArrayCreate([0, 0], varVariant);<br> v[0] := 0; // parameter passed to function<br><br> Params := PSafeArray(TVarData(v).VArray);<br> ScriptControl1.AddCode(restorepointsscript);<br> Memo1.lines.add( ScriptControl1.Run('SysRestorePoint', Params));<br><br>end;<br>---<br>procedure TForm1.FormShow(Sender: TObject);<br>begin<br> ScriptControl1.SitehWnd := Self.Handle;<br>end;<br>---<br><br>结果会在Memo1显示。至于怎么显示,在哪儿显示你自己改<br>--------<br>Scripting Your Delphi Applications 附加几个例子可以参考一下<br><br>Kind regards,<br>cipher