您现在的位置:首页 >> 图形媒体 >> 图形媒体 >> 内容

Delphi中启用禁止CD驱动器自动运行播放

时间:2011/9/3 15:00:52 点击:

  核心提示:type TAutoPlayForm = class(TForm) chkNoAutoPlay: TCheckBox; procedure FormCreate(Sender: TObject) ;...
type
   TAutoPlayForm = class(TForm)
     chkNoAutoPlay: TCheckBox;
     procedure FormCreate(Sender: TObject) ;
   private
     procedure WindowProcedure(var Msg : TMessage) ;
   end;

var
   AutoPlayForm: TAutoPlayForm;

   Message_QueryCancelAutoPlay : Cardinal;

implementation

{$R *.dfm}

procedure TAutoPlayForm.WindowProcedure(var Msg: TMessage) ;
begin
   if (Message_QueryCancelAutoPlay = Msg.Msg) then
   begin
     if chkNoAutoPlay.Checked then
       Msg.Result := 1 //disable auto-play
     else
       Msg.Result := 0; //enable auto-play
   end
   else
     inherited WndProc (Msg) ;
end;

procedure TAutoPlayForm.FormCreate(Sender: TObject) ;
begin
   Self.WindowProc := WindowProcedure;

   Message_QueryCancelAutoPlay := RegisterWindowMessage('QueryCancelAutoPlay') ;
end;

作者:站长 来源:转载
共有评论 0相关评论
发表我的评论
  • 大名:
  • 内容:
本类推荐
  • 没有
本类固顶
  • 没有
  • 盒子文章(www.2ccc.com) © 2024 版权所有 All Rights Reserved.
  • 沪ICP备05001939号