[AutoRun] open=autorun.exe//autorun.exe是你要运行的文件名字,可能是setup.exe等 icon=autorun.exe//是光盘的图标,可以单独放置一个图标文件,如ico,插入光盘后,原光盘图标将显示为此文件的图标 设置光盘的自动运行特征: procedure TForm1.SetCDAutoRun(AAutoRun:Boolean); const DoAutoRun : array[Boolean] of Integer = (0,1); var Reg : TRegistry; begin try { create our registry object } Reg := TRegistry.Create;
{ set our registry root key } Reg.RootKey := HKEY_LOCAL_MACHINE; { verify that our CDROM class key exists } if Reg.KeyExists('System') then { try to open our CDROM class key } if Reg.OpenKey('System',FALSE) then { add AutoRun to our CDROM class key } Reg.WriteBinaryData('AutoRun',DoAutoRun[AAutoRun],1); finally { free our registry object } Reg.Free; end; { showmessage that the changes will happen on reboot } ShowMessage('Your settings will take effect on the next reboot of Windows.'); en