Information about CD autorun is stored in the registry at "HKEY_LOCAL_MACHINE\System\CurrentControlSet\Services\Class\CDROM\AutoRun" path. If this parameter is 0, then autorun is disabled, if this parameter is 1, then autorun is enabled. Don't forget to add Registry in the uses chapter.
uses Registry; ... procedure TForm1.Button1Click(Sender: TObject); var i: Boolean; begin i:=False; with TRegistry.Create do begin RootKey:=HKEY_LOCAL_MACHINE; if KeyExists('System\CurrentControlSet\Services\Class\CDROM')and OpenKey( 'System\CurrentControlSet\Services\Class\CDROM', False) then WriteBinaryData('AutoRun', i, 1); end; end;