我做了钩子函数 处理用户关闭程序的问题 在一个按纽中 如果用PostMessage(Handle ,WM_CLOSE,0,0); 则可以正常拦截,程序不退出,但是如果用close函数 却拦截不道 为什么 望高手指教 下面是钩子处理函数
var
HooKHandle :HHook;
function Hooldo(code :integer;wpararm : longint;Msg:longint):longint ;stdcall;
begin
if code = HC_Action then
if PMsg(Msg)^.message = WM_CLOSE then begin
//ShowMessage('收到');
Application.Run ;
end;
Result := CallNextHookEx(HookHandle,code,wpararm,Longint(@Msg));
end
var
HooKHandle :HHook;
function Hooldo(code :integer;wpararm : longint;Msg:longint):longint ;stdcall;
begin
if code = HC_Action then
if PMsg(Msg)^.message = WM_CLOSE then begin
//ShowMessage('收到');
Application.Run ;
end;
Result := CallNextHookEx(HookHandle,code,wpararm,Longint(@Msg));
end
解决方案 »
免费领取超大流量手机卡,每月29元包185G流量+100分钟通话, 中国电信官方发货