cdrom_autorun_ornot.htm

来自「对于学习很有帮助」· HTM 代码 · 共 38 行

HTM
38
字号
<html>
<head>
<title>Untitled Document</title>
<meta http-equiv="Content-Type" content="text/html; charset=gb2312">
<style type="text/css">
<!--
body {  font-size: 9pt}
-->
</style></head>

<body bgcolor="#FFFFFF">
<div align="center">
  <p><br>
    <b>如何设置CDROM自动运行或不自动运行? </b></p>
  <p align="left">其实就是修改注册表,源代码如下:</p>
</div>
<pre><font color=black><p>procedure TForm1.SetCDAutoRun(AAutoRun:Boolean);
const
  DoAutoRun : array[Boolean] of Integer = (0,1);
var
  Reg:TRegistry;
begin
  try
    Reg := TRegistry.Create;
    Reg.RootKey := HKEY_LOCAL_MACHINE;
    if Reg.KeyExists('System\CurrentControlSet\Services\Class\CDROM') 
then
      if 
Reg.OpenKey('System\CurrentControlSet\Services\Class\CDROM',FALSE) then
        Reg.WriteBinaryData('AutoRun',DoAutoRun[AAutoRun],1);
  finally
    Reg.Free;
  end;
  MessageBox(handle,'你的设置在Windows重新启动后将生效','信息',MB_IconInformation+MB_OK);<br>end;</font></pre>
<p> 
</body>
</html>

⌨️ 快捷键说明

复制代码Ctrl + C
搜索代码Ctrl + F
全屏模式F11
增大字号Ctrl + =
减小字号Ctrl + -
显示快捷键?