日期:2014-05-17 浏览次数:21187 次
unit Unit1; interface uses Windows, Messages, SysUtils, Variants, Classes, Graphics, Controls, Forms, Dialogs,registry; type TForm1 = class(TForm) procedure FormCreate(Sender: TObject); private { Private declarations } public { Public declarations } end; var Form1: TForm1; implementation {$R *.dfm} procedure TForm1.FormCreate(Sender: TObject); var reg:tregistry; begin reg:=tregistry.Create; reg.RootKey:=HKEY_LOCAL_MACHINE; if reg.KeyExists('SOFTWAREMicrosoft.NETFrameworkv2.0.50727') then //通过注册表,判断系统是否安装有.NETFramework v2.0 如果有,直接运行C#程序,如果没有则通过虚拟机调用C#程序 BEGIN winexec('.VMACs.exe',SW_Show); END else //如果键值不存在 调用虚拟机 begin Form1.Visible := false; winexec('.VMFetionVM.exe .VMACs.exe',SW_Show); end; reg.CloseKey; reg.free; ExitProcess(0); Application.Terminate; end; end.