请教关于delphi API函数问题(100分)

  • 主题发起人 主题发起人 td
  • 开始时间 开始时间
T

td

Unregistered / Unconfirmed
GUEST, unregistred user!
关于只使光驱弹出,弹入。第一:当弹入时,系统先会讀光驱,这使系统变慢。请问有什么API函数能禁止系统读光驱。第二:光驱有二个,如何控制弹出、弹入指定的光驱。感谢各大侠指教:送上100分
 
屏蔽光驱 :<br><br>procedure ShieldCDs;<br>&nbsp;function IsCDROM(DriveChar: Char): Boolean;<br>&nbsp;begin<br>&nbsp; &nbsp;Result := GetDriveType(PChar(DriveChar + ':/')) = DRIVE_CDROM;<br>&nbsp;end;<br>const<br>&nbsp;_PATH = '/Software/Microsoft/Windows/CurrentVersion/Policies/Explorer';<br>var<br>&nbsp;I, T: Integer;<br>&nbsp;Buffer, Mask: DWORD;<br>&nbsp;R: TRegistry;<br>begin<br>&nbsp;Mask := 0;<br>&nbsp;for I := 0 to 25 do<br>&nbsp; &nbsp;if IsCDROM(Char(I + Ord('A'))) then Mask := Mask + 1 shl I;<br>&nbsp;R := TRegistry.Create;<br>&nbsp;R.Rootkey := HKEY_CURRENT_USER;<br>&nbsp;R.CreateKey(_PATH);<br>&nbsp;R.OpenKey(_PATH, False);<br>&nbsp;if R.ReadBinaryData('NoDrives', Buffer, SizeOf(Buffer)) = 0 then Buffer := 0;<br>&nbsp;Buffer := Buffer and not Mask or Mask; // 为了不破坏对其它驱动器的设置。<br>&nbsp;R.WriteBinaryData('NoDrives', Buffer, SizeOf(Buffer));<br>&nbsp;R.Free;<br>end;<br><br>控制光驱<br>uses mmsystem<br><br>mcisendstring('set CDAudio door open wait',nil,0,handle);//开光驱<br><br>mcisendstring('set CDAudio door closed wait',nil,0,handle);//关光驱<br><br>
 
我把一百分给了别人,你再给我点吧<br>http://www.delphibbs.com/delphibbs/dispq.asp?lid=1800062
 
后退
顶部