鼠标移入移出时播放声音

     阅读 507 次    更新时间:2014/4/18    
在Form中重载wndproc:

在Form中重载wndproc:

procedure WndProc(var Message : TMessage); override;


procedure TForm1.WndProc(var Message : TMessage);
begin
 if Message.LParam = Longint(Button1) then
 begin
  if (Message.Msg = CM_MOUSELEAVE) then
    sndPlaySound(nil, snd_Async or snd_NoDefault);
  if (Message.Msg = CM_MOUSEENTER) then
    sndPlaySound(pchar(FSoundFile), snd_Async or snd_NoDefault);
 end;
inherited WndProc(Message);
end;


 
 

Copyright 2003-2008 All Rights Reserved 自由风工作室 版权没有 [湘ICP备06002185号]
.