名称 |
组件类型 |
组件CAPTION |
主要过程及事件 |
说明 |
mMenuTitle |
TMenuItem |
==光驱控制== |
无 |
弹出菜单标签 |
mOpenCDROM |
TMenuItem |
打开CDROM盒 |
生成子菜单( |
打开光驱子菜单 |
mCloseCDROM |
TMenuItem |
关闭CDROM盒 |
生成子菜单 |
关闭光驱子菜单 |
mAutoRun |
TMenuItem |
置启动时执行 |
mAutoRunClick |
开机运行 |
mNotAutoRun |
TMenuItem |
自动执行无效 |
SetCDAutoRun(False) |
取消开机运行 |
mCloseApp |
TMenuItem |
关闭控制程序 |
Application.Terminate; |
关闭控制程序 |
… … procedure mCloseAppClick(Sender: TObject); procedure mAutorunClick(Sender: TObject); procedure mNotautorunClick(Sender: TObject); procedure PopmenuCDctrlPopup(Sender: TObject); private { Private declarations } procedure MenuOpenCdrom(Sender : TObject); procedure MenuCloseCdrom(Sender : TObject); var Form1: TForm1; MYDRIVE:char; Mycdrom:pchar; tmppopmenu1,tmpPopmenu2:TMenuItem; function OpenCDROM(Drive:pChar):Boolean; function CloseCDROM(Drive:pChar):Boolean; implementation … … |
procedure TForm1.PopupMenu1Popup(Sender: TObject); var Drive :char; begin; mOpenCdrom.Clear; //清除打开光驱子菜单项 mCloseCdrom.Clear; //清除打开光驱子菜单项 //列出光驱数目和生成子菜单 for Drive:='a' to 'z' do begin Case GetDriveType(Pchar(Drive+':\')) of DRIVE_REMOVABLE: MyDrive:=Drive; DRIVE_FIXED: MyDrive:=Drive; DRIVE_CDROM: begin MyDrive:=Drive; tmppopmenu1:=TMenuItem.Create(Self); tmppopmenu1.AutoHotkeys:=maManual; tmppopmenu1.OnClick := menuOpenCdrom; mOpenCDROM.Add(tmppopmenu1); tmppopmenu1.Caption :=UpperCase(mydrive)+':'; tmppopmenu2:=TMenuItem.Create(Self); tmppopmenu2.AutoHotkeys:=maManual; tmppopmenu2.OnClick := menuCloseCdrom; mCloseCDROM.Add(tmppopmenu2); tmppopmenu2.Caption :=UpperCase(mydrive)+':'; end; DRIVE_RAMDISK: MyDrive:=Drive; DRIVE_REMOTE: MyDrive:=Drive; end; end; //当光驱多于1个生成“所有光驱”控制菜单项 if mOpenCDROM.Count > 1 then begin tmppopmenu1:=TMenuItem.Create(Self); tmppopmenu1.Caption:='所有光驱'; tmppopmenu1.OnClick := menuOpenCdrom; mOpenCDROM.Add(tmppopmenu1); tmppopmenu2:=TMenuItem.Create(Self); tmppopmenu2.Caption:='所有光驱'; tmppopmenu2.OnClick := menuCloseCdrom; mCloseCDROM.Add(tmppopmenu2); end; end; |
欢迎访问最专业的网吧论坛,无盘论坛,网吧经营,网咖管理,网吧专业论坛
https://bbs.txwb.com
关注天下网吧微信/下载天下网吧APP/天下网吧小程序,一起来超精彩
|
本文来源:网络 作者:佚名