本人做了一个小程序,程序一运行便自动隐藏到系统托盘,类似于
WINAMP,现在有一个烦人的问题,就是它会阻止关闭(或重启、注
销)系统,只有把主界面显示出来才不会有这样的问题,我已经在
程序里加了接收关闭系统的消息的过程,为什么当它隐藏时就接收
不到。Procedure WMQueryEndSession(Var Msg: TWMQueryEndSession); message WM_QueryEndSession;Procedure TFrm_Main.WMQueryEndSession(Var Msg: TWMQueryEndSession);
Begin
Msg.Result := 1;
Application.Terminate;End;
请各位高手帮我解决一下!!
WINAMP,现在有一个烦人的问题,就是它会阻止关闭(或重启、注
销)系统,只有把主界面显示出来才不会有这样的问题,我已经在
程序里加了接收关闭系统的消息的过程,为什么当它隐藏时就接收
不到。Procedure WMQueryEndSession(Var Msg: TWMQueryEndSession); message WM_QueryEndSession;Procedure TFrm_Main.WMQueryEndSession(Var Msg: TWMQueryEndSession);
Begin
Msg.Result := 1;
Application.Terminate;End;
请各位高手帮我解决一下!!
系统关机时发送给每个正在执行的程序的消息,难道也有选择性吗—————————————————————————————————
中国鹰派
杀光小日本,拒绝韩日货!
procedure MyAppMsg(var Msg: TMsg;var Handled: Boolean);
begin
handled := False;
if Msg.Message = wm_queryendsession then
begin
//add your code here
handled := True;
end;
end;Form OnCreate
begin
Application.OnMessage := MyAppMsg;
end;看看行不行的通
------------------------------------------------------------procedure MyAppMsg(var Msg: TMsg;var Handled: Boolean);
begin
if (Msg.Message = wm_queryendsession) or (Msg.Message = wm_EndSession) then
begin
Application.Terminate ;
end;
end;Form OnCreate
begin
Application.OnMessage := MyAppMsg;
end;