首页  编辑  

鼠标移入移出时播放声音

Tags: /超级猛料/VCL/用户接口(界面)/   Date Created:
在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;