if (msg.msg=wm_traymsg)and(factive) then
begin
case msg.lparam of
wm_lbuttondblclk://左双击
begin
getcursorpos(p);
dblclick;
mousedown(mbleft, keystoshiftstate(twmmouse(msg).keys)+[ssdouble], p.x, p.y);
if frmode=ldbclick then
begin
showwindow(application.handle,sw_show);
//这里很重要的一个就是恢复窗口风格,不然下次把active设为true
//最小化后,窗口依然会往左下角飞去,而托盘图标却看不见了.
setwindowlong(application.handle,gwl_exstyle ,oldstyleex);
sendmessage(application.handle,wm_syscommand,sc_restore,0);
settray(nim_delete);
end;