难题~delphi中鼠标移动到图标下时触发事件

难题~~~~~~~delphi中鼠标移动到图标上时触发事件
我之前做了一个 托盘系统,当鼠标移动到托盘程序的小图标时,触发一个事件查询数据库信息,并显示在小图标浮标信息中


代码如下:
procedure Tmainform.WndProc(var Msg:TMessage);
var
  pt:TPoint;
  I:integer;
begin
  if Msg.Msg = WM_TRAYNOTIFY then
  begin
 // IconID:= Msg.WParam;
  GetCursorPos(pt);
  case Msg.LParam of
  WM_MOUSEMOVE:
  begin
  //鼠标在图标上移动

    StrpCopy(NotifyIcon.szTip, getstr('b'));  //pchar(getstr)
    Shell_NotifyIcon(NIM_MODIFY, @NotifyIcon);


  end;
end;

其中getstr('b')是一个 function 函数

但是现在运行出来以后,但不运行 发现系统重复运行上面的代码,导致服务器查询oracel数据出错,系统出错。
求高手怎么修改代码,使鼠标移动到图标上的时候只运行一次代码?


小弟不胜感激,另外加分
------解决方案--------------------
改用cm_mouseenter消息
------解决方案--------------------
Delphi精要 179页有介绍,很详细。